Vladimir Marangozov wrote: > >... > Paul, this is clearly unclear <0.1 wink>. I for one don't get it. > The whole point of __getattr__, __setattr__ is to trap attribute > accesses and assignment. Sure, but ALL attribute accesses and assignment. What if you just want to trap one or two or ten? > However, this is defined only for Python's instance objects. If this > is intended to generalize the concept for builtin objects, then you > reach the object model deficiencies (metacalass, type dochotomy, etc.) > which is not a trivial problem. This feature has nothing to do with built-in types. Built-in types *always* use the getattr convention anyhow. > If you're running after performance, because this programmable trapping > occurs only in Python, well, state it explicitely in your writing. I mentioned performance explicitly in the introduction: > This PEP describes a feature that makes it easier, more efficient > and safer to implement these handlers in Python than it is today. Performance is only one of the goals. Clarity is the more major one. Safety is another. When you start combining __getattr__ with multiply inherited base class __getattr__ and so forth you get into a real mess. This proposal does not have that problem. > If the handlers are written in Python, this is what you get with __getattr__ > and __setattr__. If you think C handlers, well, tell us about it explicitely. The proposal explicitly says that the propsal allows nothing that getattr and setattr do not already allow. If you're looking for something that they do that this doesn't, you won't find it. Rather: > This PEP describes a feature that makes it easier, more efficient > and safer to implement these handlers in Python than it is today. Not a new ability, just a more structured way to exercise it. -- Paul Prescod - Not encumbered by corporate consensus "Hardly anything more unwelcome can befall a scientific writer than having the foundations of his edifice shaken after the work is finished. I have been placed in this position by a letter from Mr. Bertrand Russell..." - Frege, Appendix of Basic Laws of Arithmetic (of Russell's Paradox)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4