From 7ab7156341aee7271f1e3d1401951ae9c7b1d875 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Mon, 7 Feb 2005 20:43:00 +0000 Subject: [PATCH 1/1] Don't do str() on Numeric arrays git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31830 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- wxPython/wx/py/introspect.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/wxPython/wx/py/introspect.py b/wxPython/wx/py/introspect.py index 5b2702277a..f134a28ce7 100644 --- a/wxPython/wx/py/introspect.py +++ b/wxPython/wx/py/introspect.py @@ -49,18 +49,22 @@ def getAttributeNames(object, includeMagic=1, includeSingle=1, try: attributes += object._getAttributeNames() except: pass # Get all attribute names. - attrdict = getAllAttributeNames(object) - # Store the object's dir. - object_dir = dir(object) - for (str_obj, technique, count), attrlist in attrdict.items(): - # This complexity is necessary to avoid accessing all the - # attributes of the object. This is very handy for objects - # whose attributes are lazily evaluated. - if str(object) == str_obj and technique == 'dir': - attributes += attrlist - else: - attributes += [attr for attr in attrlist \ - if attr not in object_dir and hasattr(object, attr)] + str_type = str(type(object)) + if str_type == "": + attributes += dir(object) + else: + attrdict = getAllAttributeNames(object) + # Store the object's dir. + object_dir = dir(object) + for (str_obj, technique, count), attrlist in attrdict.items(): + # This complexity is necessary to avoid accessing all the + # attributes of the object. This is very handy for objects + # whose attributes are lazily evaluated. + if str(object) == str_obj and technique == 'dir': + attributes += attrlist + else: + attributes += [attr for attr in attrlist \ + if attr not in object_dir and hasattr(object, attr)] # Remove duplicates from the attribute list. for item in attributes: -- 2.45.2