property problem

Peter Maas peter.maas at mplusr.de
Fri Jul 19 04:22:13 EDT 2002


Daniel Fackrell wrote:
>>class proptest:
>>
>>  def __init__(self):
>>  self.__data = 0
> 
> 
> This declaration invokes python's name mangling.  The creation of x later
> will call this constructor and the __data attribute will appear as
> x._proptest__data (I think).

[...]

>>This is my testcode:
>>
>> >>> x = proptest()
>> >>> x.data=234
> 
> 
> This line creates a new attribute named x.data, which is completely
> unrelated to x._proptest__data

Daniel,

it's not unrelated because of the property call
in my code. I missed the fact that I had to subclass object.
Thanks for your help.

Regards,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------




More information about the Python-list mailing list