Guido van Rossum <guido@python.org> writes: >> However, I think it might also cost an extra property object per >> wrapped class, unless I can find a way to get the class and its >> instance to share the property. Hmm, feels a bit hack-ish to me now >> that you mention it. Maybe option 2 is better after all. But then, >> do I want to implement tp_getattr or tp_getattro? I don't recall the >> differences. > > Definitely tp_getattro. The difference is that tp_getattr takes a C ^^^^^^^^^^ > string argument and tp_getattr takes a Python string object. ^^^^^^^^^^ I guess I can figure out which you mean by looking at the source (Luke). >> > When you call it yourself (rather than when it is called as a result >> > of __getattribute__). >> >> When do you call it yourself? > > I've never called it myself except in the test suite. > >> > I suppose this is a bit redundant. >> >> I guess; I don't know. I'm trying to understand whether "callable >> with one or two arguments" is really part of the requirements for use >> as a property method, or just something that got thrown in there. > > The latter. The type argument was an afterthought -- I had originally > not thought about class attribute access at all. OK; I hope you like the doc patch I submitted, then. It doesn't require "callable with one argument", only two. -- Dave Abrahams Boost Consulting www.boost-consulting.com
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