Message303968
The [descriptor howto](https://docs.python.org/3/howto/descriptor.html#invoking-descriptors) states:
"For example, obj.d looks up d in the dictionary of obj. If d defines the method __get__(), then d.__get__(obj) is invoked [...]"
This is not true - the descriptor obtained from obj's dictionary is never invoked. If it was, the following two snippets would produce output:
class Class:
pass
obj = Class()
obj.__dict__['d'] = property(lambda: print('called'))
_ = obj.d # nothing is printed.
class Obj:
@property
def d(self):
print('called')
_ = Obj.d # nothing is printed. |
|
Date |
User |
Action |
Args |
2017-10-09 15:04:44 | Paul Pinterits | set | recipients:
+ Paul Pinterits, docs@python |
2017-10-09 15:04:44 | Paul Pinterits | set | messageid: <1507561484.86.0.213398074469.issue31735@psf.upfronthosting.co.za> |
2017-10-09 15:04:44 | Paul Pinterits | link | issue31735 messages |
2017-10-09 15:04:44 | Paul Pinterits | create | |
|