[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-25 Thread Raymond Hettinger
Raymond Hettinger added the comment: Some thoughts: * The docs talk about descriptor invocation from "attribute access". The reason they don't say "dotted access" is that the descriptors can be invoked in multiple ways: dotted access, getattr()/setattr() functions, super(), or direct

[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-25 Thread Raymond Hettinger
Change by Raymond Hettinger : -- assignee: -> rhettinger components: +Documentation -Interpreter Core versions: -Python 3.6, Python 3.7 ___ Python tracker ___

[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-25 Thread Hugo Ricateau
Hugo Ricateau added the comment: Thanks for this detailed answer; very instructive :) > the descriptor protocol is only triggered by "dotted access" Indeed; this is what I was missing... despite it is indirectly mentioned in the documentation. Nonetheless, it could be worth the overload to

[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-24 Thread Eric Snow
Eric Snow added the comment: @Raymond, What do you think about adding a helpful note or two in the docs? -- nosy: +rhettinger ___ Python tracker ___

[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-24 Thread Eric Snow
Eric Snow added the comment: First of all, thanks for asking about this. Everything is working as expected. Let's look at why. First, be sure the behavior of descriptors is clear: the descriptor protocol is only triggered by "dotted access" on an object ("obj.attr"). So you should

[issue39443] Inhomogeneous behaviour for descriptors in between the class-instance and metaclass-class pairs

2020-01-24 Thread Hugo Ricateau
New submission from Hugo Ricateau : Assume one has defined the following descriptor: ``` class Descriptor: def __set__(self, instance, value): print('SET') ``` On the one hand, for the class-instance pair, the behaviour is as follows: ``` class FirstClass: descriptor =