dir() and propertly list NEWBIE

Donn Cave donn at u.washington.edu
Tue Nov 23 17:40:25 EST 1999


Quoth tiddlerdeja at my-deja.com:
| Is it possible to get the functions of an object using dir()? Rather
| that looking them up in a book/API.

Yes, though not directly through the object and it's not real simple.

   def printcdir(c):
       print dir(c)
       for b in c.__bases__:
           printcdir(b)

   def printxdir(instance):
       print dir(instance)
       printcdir(instance.__class__)

| Similarly, If I can get an objects functions, is it possible then get a
| list of the possible parameters for that function?

No!  Wouldn't that be nice?

	Donn Cave, University Computing Services, University of Washington
	donn at u.washington.edu




More information about the Python-list mailing list