"luofeiyu" <elearn2...@gmail.com> wrote in message news:53f48957.8020...@gmail.com... > So in this example: >>> class Person(object): >>> def __init__(self, name): >>> self._name = name >> [...] >>> name = property(getName, setName, delName, "name property docs") >> >> >> (3) name is the public attribute that other classes or functions are >> permitted to use. >> >> >> problem 1: there is no self.name = something in the defination ,why i >> can get bob.name? >> >>
I also found it confusing at first, but reading the docs and trying out the examples at the interpreter prompt helped a lot. Here is the relevant doc page - https://docs.python.org/3/library/functions.html#property If you really want to know what goes on under the hood, Google turned up this in-depth explanation - http://stackoverflow.com/questions/17330160/how-does-the-property-decorator-work HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list