[Python-bugs-list] [ python-Bugs-456420 ] no __methods__ for lists, strings etc.

noreply@sourceforge.net noreply@sourceforge.net
Wed, 29 Aug 2001 15:10:23 -0700


Bugs item #456420, was opened at 2001-08-29 00:32
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456420&group_id=5470

Category: Type/class unification
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Detlef Lannert (lannert)
>Assigned to: Tim Peters (tim_one)
Summary: no __methods__ for lists, strings etc.

Initial Comment:
With Python 2.2a2+ from cvs, [].__methods__ fails with

AttributeError: 'list' object has no attribute
'__methods__'

Same for a string or a dictionary.

The Library Reference section on "Special Attributes"
(2.1.9 here) still recommends [].__methods__ for
finding out about an object's methods.

dir([]) returns [] and doesn't list the attributes
either.

OK, I can use [].__class__.__dict__.keys() -- but it's
not very intuitive ...

  Detlef


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-08-29 15:10

Message:
Logged In: YES 
user_id=31435

Reassigned to me.  __members__ and __methods__ were always 
ugly hacks, and we'd like to get rid of them.  I'm making 
dir() "smarter" again, so that dir([]) will be more 
informative (see bug 449989).

Until then, try using dir(type([])) (more generally, dir
(type(object)) instead of the atrocious 
[].__class__.__dict__.keys().

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=456420&group_id=5470