From: Guido van Rossum Date: Mon, 10 Dec 2001 18:03:34 +0000 (+0000) Subject: Fix the Python property class in a comment right. X-Git-Tag: v2.2.1c1~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba2485f9470c9ce6040a88336f998f5f7e73e8aa;p=thirdparty%2FPython%2Fcpython.git Fix the Python property class in a comment right. --- diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 850630245429..4022e89acd53 100644 --- a/Objects/descrobject.c +++ b/Objects/descrobject.c @@ -904,28 +904,29 @@ PyWrapper_New(PyObject *d, PyObject *self) /* class property(object): - def __init__(self, fget=None, fset=None, fdel=None, doc=None): - self.__get = fget - self.__set = fset - self.__del = fdel - self.__doc__ = doc - - def __get__(self, inst, type=None): - if self.__get is NULL: - raise AttributeError, "unreadable attribute" - if inst is None: - return self - return self.__get(inst) - - def __set__(self, inst, value): - if value is None: - if self.__del is None: - raise AttributeError, "can't delete attribute" - return self.__del(inst) - else: - if self.__set is None: - raise AttributeError, "can't set attribute" - return self.__set(inst, value) + def __init__(self, fget=None, fset=None, fdel=None, doc=None): + self.__get = fget + self.__set = fset + self.__del = fdel + self.__doc__ = doc + + def __get__(self, inst, type=None): + if self.__get is None: + raise AttributeError, "unreadable attribute" + if inst is None: + return self + return self.__get(inst) + + def __set__(self, inst, value): + if self.__set is None: + raise AttributeError, "can't set attribute" + return self.__set(inst, value) + + def __delete__(self, inst): + if self.__del is None: + raise AttributeError, "can't delete attribute" + return self.__del(inst) + */ typedef struct {