property puzzle

Shalabh Chaturvedi shalabh at cafepy.com
Thu Aug 26 19:01:28 EDT 2004


Jean Brouwers wrote:
> Also, property needs bound methods to get, set, and delete, like
> 
>     status = property(self._get_status, self._set_status)
> 
> /Jean Brouwers

No it doesn't. The following is a working piece of code:

class C(object):
    def getx(self):
       return 1

    x = property(getx)

print C().x

Prints 1 as expected.

--
Shalabh




More information about the Python-list mailing list