Robert Bradshaw wrote:

> I think this is a philosophical difference between Cython and Pyrex-- 
> ... Eventually one should be able to take  
> any .py file, run Cython on it, and have it behave exactly the same.

Actually, it would, because a pure Python file isn't
going to contain any extension classes, and whatever
else is done, __getattribute__ on a Python class should
follow Python semantics.

But this is certainly a difference in goals between
Pyrex and Cython. The goal of Pyrex is not to compile
Python efficiently, but to enable efficient bridging
between Python and C.

> In terms of efficiency, __getattribute__ is called at the top, and on  
> success tp_getattr returns immediately, so it should be just about as  
> fast.

To my mind, the semantic difference is actually a
feature -- it lets you completely control what it
means to look up an attribute of your object.

A compromise might be to find another name for the
method that directly fills tp_getattr. But then
we'd have *three* variants of attribute-getting
methods to keep straight... not sure if that would
be an improvement or not.

-- 
Greg

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to