[Tutor] property built-in

thomas thomas.coopman at gmail.com
Thu Oct 19 19:03:03 CEST 2006


Hi,


I was wondering some things about property.

suppose I have a class like this:

class A(object):
    def __init__(self, x, y):
       self.__x = x

    def x():
       def get(self):
          return self.__x

       def set(self, x):
          self.__x = x
          #and some other code that is important

    x= property(**x())

questions:
    1: why doesn't there have to be a self in x()?
    2: how do I address the setter of x in the init?

I think these are basic questions, but I can't seem to find out how to 
do it.


Thanks


More information about the Tutor mailing list