diff options
author | Guido van Rossum <guido@python.org> | 2001-12-10 18:03:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-12-10 18:03:34 (GMT) |
commit | ba2485f9470c9ce6040a88336f998f5f7e73e8aa (patch) | |
tree | 7c3a9ced1f80378b49a3a8dd82030118ff8b7da3 /Objects/descrobject.c | |
parent | b75ba918d6f8e9744c7da4660721a0058a6968a5 (diff) | |
download | cpython-ba2485f9470c9ce6040a88336f998f5f7e73e8aa.zip cpython-ba2485f9470c9ce6040a88336f998f5f7e73e8aa.tar.gz cpython-ba2485f9470c9ce6040a88336f998f5f7e73e8aa.tar.bz2 |
Fix the Python property class in a comment right.
Diffstat (limited to 'Objects/descrobject.c')
-rw-r--r-- | Objects/descrobject.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/Objects/descrobject.c b/Objects/descrobject.c index 8506302..4022e89 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 { |