different instances with different data descriptors with the same name
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Feb 18 13:53:32 EST 2008
En Mon, 18 Feb 2008 08:21:11 -0200, Fabrizio Pollastri
<f.pollastri at inrim.it> escribi�:
> Data descriptors are set as attributes of object types. So if one has
> many
> instances of the same class and wants each instance to have a different
> property
> (data descriptor) that can be accessed with a unique attribute name, it
> seems to
> me that there is no solution with data descriptors. There is any
> workaround to
> this? Thank in advance for any help.
Use __getattr__ or change dynamically each instance's class. See this
recent thread:
http://groups.google.com/group/comp.lang.python/browse_frm/thread/bfc093464dd6ba9/
--
Gabriel Genellina
More information about the Python-list
mailing list