[Python-3000] Help replacing Py_FindMethod
jeremy.kloth at gmail.com
Tue Jul 29 19:02:07 CEST 2008
On Tue July 29 2008 8:42:08 am Jesus Cea wrote:
> Amaury Forgeot d'Arc wrote:
> |> My doubt now is how do write a *clever* "getattr" routine without
> |> "Py_FindMethod".
> | Well, I'd write a "tp_getattro" member function,
> | which would do its "clever" things before it falls back to
> | PyObject_GenericGetAttr to get the usual behaviour.
> Now I'm confused about difference between "tp_getattro" and
> "tp_getattr", and when to use them.
> I guess that "tp_methods" and "tp_members" are faster, but only usable
> when the data is "static" and available, while "tp_getattr" and friends
> are used when you need to execute some code in the lookup. But I read
> somewhere that "tp_getattr" was deprecated :-? ...
There is also the "tp_getset" slot (right after the "tp_members" slot) which
is exactly for "computed" attribute access. See:
for further information.
More information about the Python-3000