[Python-Dev] Data descriptor doc/implementation inconsistency (original) (raw)
Michael Foord fuzzyman at voidspace.org.uk
Mon Jan 11 23:11:44 CET 2010
- Previous message: [Python-Dev] Data descriptor doc/implementation inconsistency
- Next message: [Python-Dev] Data descriptor doc/implementation inconsistency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 11/01/2010 21:12, Nick Coghlan wrote:
Benjamin Peterson wrote: > My question is: Is this a doc bug or a implementation bug? If the
former, it will be the description of a data descriptor much less consistent, since it will require that a get method be present, too. If the latter, the fix may break some programs relying on the ability to "cache" a value in the instance dictionary.
[1] http://docs.python.org/reference/datamodel#invoking-descriptors [snip...] Note that the behaviour here is still different from that of a data descriptor: with a data descriptor, once it gets shadowed in the instance dictionary, the descriptor is ignored completely. The only way to get the descriptor involved again is to eliminate the shadowing. The non-data descriptor with only set is just choosing not to override the attribute lookup process.
Does that mean we need a third class of descriptors that are neither data descriptors nor non-data descriptors?
What should we call them: really-not-data-descriptors?
All the best,
Michael
Cheers, Nick.
-- http://www.ironpythoninaction.com/ http://www.voidspace.org.uk/blog
READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.
- Previous message: [Python-Dev] Data descriptor doc/implementation inconsistency
- Next message: [Python-Dev] Data descriptor doc/implementation inconsistency
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]