[Tutor] Interesting problem

Alan G alan.gauld at freenet.co.uk
Thu Jun 23 22:49:02 CEST 2005

> Consider a class with a lt of properties.  I would like a member
> function which generates a dictionary where the keys are the
> names and the values are the property values?

Use the force... :-)

Since Python uses dictionaries to store all those things
already there must be a suitable bit of black magic that will
serve it up on a plate.

Doing some reading around the innards of classes should shed
light on it.

Alan G.

More information about the Tutor mailing list