On Tue, Aug 17, 2010 at 9:41 PM, Carl Witty <[email protected]> wrote: > On Tue, Aug 17, 2010 at 9:27 PM, Robert Bradshaw > <[email protected]> wrote: >> Yep. I confirmed that just setting creating __getattr__ does incur the >> performance loss, even if __getattribute__ was good. It looks like >> there's no way to have a __getattr__ python-visible attribute without >> a performance penalty. > > Well, I think (but I'm not sure) that if the python-visible > __getattr__ is an instance of PyWrapperDescr_Type, then the problem > doesn't arise.
Looking at typeobjet.c:slot_tp_getattr_hook, I'm not sure even this would help, but I haven't fully unraveled the logic of update_one_slot. Worth further investigation and/or a try. > And like I said, there's a somewhat simple workaround > if you actually know about the problem, which is to define > __getattribute__ instead of __getattr__. Which is essentially what we do in Cython already. (It's a pain to do on the user's side, and almost always not what you want.) - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
