[Python-ideas] Multiple arguments for decorators
Random832
random832 at fastmail.com
Tue Dec 1 10:29:02 EST 2015
On 2015-12-01, Nick Coghlan wrote:
> The trick with property is that it hides the "self" that refers to the
> descriptor object itself,
Yes, but if the descriptor object is a class, then there is no "self"
because it's called as a static method. The missing owner parameter is
the only problem when it's called in the way that the descriptor howto
says it is called [type(b).__dict__['x'].__get__(b, type(b))].
It doesn't actually work as written, of course, since it doesn't have
any way of knowing myprop is meant to be a descriptor. But the self
parameter isn't the issue.
Incidentally, I'm not sure I understand what the owner parameter is for,
and what purpose it can be useful for which it isn't also needed on the
setter.
More information about the Python-ideas
mailing list