Finding the name of a class
John Salerno
johnjsal at NOSPAMgmail.com
Thu Aug 3 12:52:05 EDT 2006
Shane Hathaway wrote:
> The bug is that the expression "dir(someclass)", where the class is a
> user-defined class of either new or old style, never reveals to the user
> that the class object has a __name__ attribute.
I guess maybe it is a bug. This seems to be the relevant code to prove it:
>>> class Foo(object):
pass
>>> dir(Foo)
['__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__',
'__hash__', '__init__', '__module__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__']
>>> Foo.__name__
'Foo'
Tim can report it if he wants, since he found it first. Otherwise I'll
do it and it will give me a chance to see how the bug reporting process
works.
More information about the Python-list
mailing list