[Python-bugs-list] [ python-Bugs-472940 ] can't getattr() attribute shown by dir() (original) (raw)
noreply@sourceforge.net noreply@sourceforge.net
Sat, 20 Oct 2001 06:01:51 -0700
- Previous message: [Python-bugs-list] [ python-Bugs-473060 ] Doc/ doesn't compile in 2.2b1
- Next message: [Python-bugs-list] [ python-Bugs-473009 ] binascii_b2a_base64() improper str limit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Bugs item #472940, was opened at 2001-10-19 15:31 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=472940&group_id=5470
Category: Python Interpreter Core Group: None Status: Open Resolution: None Priority: 5 Submitted By: Jeremy Hylton (jhylton)
Assigned to: Tim Peters (timone) Summary: can't getattr() attribute shown by dir()
Initial Comment: I occasionally write introspective code that does something like:
for attr in dir(obj): print attr, getattr(obj, attr)
I ran into a problem with it, though:
ArithmeticError.init dir(ArithmeticError.init) ['call', 'class', 'cmp', 'delattr', 'dict', 'doc', 'get', 'getattribute', 'hash', 'init', 'name', 'new', 'reduce', 'repr', 'setattr', 'str', 'im_class', 'im_func', 'im_self'] 'dict' in dir(ArithmeticError.init) 1 ArithmeticError.init.dict Traceback (most recent call last): File "", line 1, in ? AttributeError: 'builtin_function_or_method' object has no attribute 'dict'
Comment By: Guido van Rossum (gvanrossum) Date: 2001-10-20 06:01
Message: Logged In: YES user_id=6380
For Tim.
Is it possible that the dict comes from looking at all the attributes of foo.class? ArithmeticError.init.class has a dict attribute.
You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=105470&aid=472940&group_id=5470
- Previous message: [Python-bugs-list] [ python-Bugs-473060 ] Doc/ doesn't compile in 2.2b1
- Next message: [Python-bugs-list] [ python-Bugs-473009 ] binascii_b2a_base64() improper str limit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]