[ python-Bugs-1056293 ] dir() should only return strings
SourceForge.net
noreply at sourceforge.net
Thu Oct 28 20:08:16 CEST 2004
Bugs item #1056293, was opened at 2004-10-28 13:08
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1056293&group_id=5470
Category: Python Interpreter Core
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Nobody/Anonymous (nobody)
Summary: dir() should only return strings
Initial Comment:
Calling this a bug in Python is probably a misnomer.
Think of it as more of a "request for workaround".
Recent versions of SWIG create wrapper classes that
contain a Python class as a key in their __dict__'s.
Consequently, something like
[k for k in dir(obj) if k.startswith("set_")]
because there is an element in dir(obj) that's not a
string or a unicode object.
I realize dir() is mostly a debugging aid, unlikely to be
used frequently in production code, but I'd like see the
docs updated so that it's guaranteed to only return
strings or unicode objects and I'd like its implementation
changed to enforce that (and maybe even warn if
something else is found).
If this is seen as an acceptable change I will work up a
patch.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1056293&group_id=5470
More information about the Python-bugs-list
mailing list