object.*

Diez B. Roggisch deetsNOSPAM at web.de
Thu Aug 26 11:54:43 EDT 2004


DeadWisdom wrote:

> I think there should be an ability in python to write something like
> "object.*" which should return a dictionary object containing all the
> members and their values for the given object.  Maybe ".*" could be
> treated as an operator. ::shrug::
> 
> Perhaps the functionality already exists in some other syntax; if so
> please splain.


dict([(n, getattr(object, n)) for n in dir(object)])

Not really worth an operator :)

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list