property puzzle

Shalabh Chaturvedi shalabh at cafepy.com
Fri Aug 27 01:01:28 CEST 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