[ZODB-Dev] ExtensionClass.__str__ and __repr__
Shane Hathaway
shane at zope.com
Thu Jun 26 11:29:04 EDT 2003
Christian Reis wrote:
> >>> from ZODB import Persistent
> >>> class Foo(Persistent): pass
> ...
> >>> class Bar: pass
> ...
>
> >>> repr(Bar)
> '<class __main__.Bar at 0x811fe5c>'
> >>> str(Bar)
> '__main__.Bar'
>
> >>> repr(Foo)
> '<extension class __main__.Foo at 8142870>'
> >>> str(Foo)
> '<extension class __main__.Foo at 8142870>'
>
> Is it a bug, and if I provide a patch, would it be accepted?
New-style classes behave like ExtensionClass in this regard, so I think
ExtensionClass does the right thing.
>>> class Bar(object): pass
...
>>> str(Bar)
"<class '__main__.Bar'>"
>>> repr(Bar)
"<class '__main__.Bar'>"
Shane
More information about the ZODB-Dev
mailing list