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

noreply@sourceforge.net noreply@sourceforge.net
Mon, 03 Dec 2001 09:07:28 -0800


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: Documentation
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Detlef Lannert (lannert)
>Assigned to: Fred L. Drake, Jr. (fdrake)
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-12-03 09:07

Message:
Logged In: YES 
user_id=31435

We haven't gotten more complaints about this, so changed to 
Docs and reassigned to Fred:  __methods__ and __members__ 
are history in 2.2.  I'm not sure where they were 
documented before, though!

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

Comment By: Tim Peters (tim_one)
Date: 2001-09-05 12:26

Message:
Logged In: YES 
user_id=31435

I want more feedback from 2.2a3 first.  If __methods__ and 
__members__ are going to stay dead, then the docs need to 
be changed, but I'm not yet sure enough that they're going 
to stay dead.

This particular report seemed driven to try them because of 
2.2a2 dir() behavior, so I *hope* the 2.2a3 dir() changes 
will be enough that we don't see another of these.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-05 11:15

Message:
Logged In: YES 
user_id=6380

Maybe this should be reclassified as a doc bug and assigned
to Fred?

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

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