[ZODB-Dev] ExtensionClass.__str__ and __repr__

Christian Reis kiko at async.com.br
Wed Jun 25 21:18:23 EDT 2003


Though not strictly ZODB-ish, I ran into the following oddity with
ExtensionClass (that bleeds into Persistent): __str__ doesn't work as
for normal classes.

    >>> 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?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL



More information about the ZODB-Dev mailing list