Property error
king kikapu
aboudouvas at panafonet.gr
Thu Dec 14 17:56:27 EST 2006
Hi to all,
i am trying to use properties in Python and i am sure i have made
something wrong with the below code but i just cannot see what it is.
Can anyone please help me on this ?
The code is :
class Person(object):
age = 0
@property
def age():
def fget(self):
return self.age
def fset(self, value):
self.age = value
me = Person()
me.age = "34"
print me.age
and i am getting the error:
" File "C:\projects\Python\p2.py", line 12, in <module>
me.age = "34"
AttributeError: can't set attribute "
What exactly i am doing wrong ??
Thanks a lot in advance.
More information about the Python-list
mailing list