[Python-3000] Help replacing Py_FindMethod

Jesus Cea jcea at jcea.es
Tue Jul 29 16:42:08 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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 :-? ...

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea at jcea.es - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:jcea at jabber.org         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBSI8sQJlgi5GaxT1NAQKmegP/XMCw9xprI2GGYvFrsO40Gck0AOk/bSl1
TiDYGuBqocY8aE/HQcU5AENbCUM0z2XxBwPjUbzCqDS3s+Y/AoCi0CMpCRqKkz4g
EYTLZqfQmOMWe41oXU57h+7JH+6knXXV/D12Mufhg/NzSWvUQuxXpIMLkvvbigV1
trtark4zmzU=
=2kph
-----END PGP SIGNATURE-----


More information about the Python-3000 mailing list