[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Re: different instances with different data descriptors with the same name

Gabriel Genellina

2/18/2008 6:54:00 PM

En Mon, 18 Feb 2008 08:21:11 -0200, Fabrizio Pollastri
<f.pollastri@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/bfc093...

--
Gabriel Genellina