[docs] [issue31735] Documentation incorrectly states how descriptors are invoked
report at bugs.python.org
Tue Oct 10 04:46:31 EDT 2017
Henk-Jaap Wagenaar <wagenaarhenkjaap at gmail.com> added the comment:
"We know this doesn't happen because nothing is printed to stdout."
Try running Obj().d, you will get output.
Obj.d does not work because it is on a *class*, and so it runs, per the docs:
whereas you consider running it on an instance to get:
b = Obj()
# equivalent to
and you will get output twice.
[Note, on python2 you will get an error, I think this is because your class does not inherit from object.]
Python tracker <report at bugs.python.org>
More information about the docs