[Python-ideas] The Descriptor Protocol...

Guido van Rossum guido at python.org
Wed Mar 2 18:59:57 CET 2011

On Wed, Mar 2, 2011 at 9:09 AM, Martin Chilvers
<martin.chilvers at gmail.com> wrote:
> Hi Raymond,
> On 02/03/2011 16:10, Raymond Hettinger wrote:
>> I've gotten this question a couple times. There usual answers are:
>> * Why? Because Guido implemented it that way ;-)
>> * Why did he pick a signature that dropped the "key"? Mostly likely, it
>> is because none of the use-cases he had in mind required it. The keyless
>> API suffices to implement property(), super(), classmethod(),
>> staticmethod(), bound method, __slots__, various features of new-style
>> classes, and a reimplementation old-style classes.
> Probably so, but it still smells in terms of the information flow through
> the various levels of the API :^)

It never occurred to me to think of the descriptor protocol the way
you do, and it never even occurred to me to that the key would ever be
needed. You can invoke principles of information flow until you're
blue in the face, but IMO it is totally reasonable to drop information
that has been used already as a request passes through layers of
abstraction. FWIW, rhetorical questions like "why doesn't Python do X"
are usually a poor way to start a discussion about a feature request.

--Guido van Rossum (python.org/~guido)

More information about the Python-ideas mailing list