Robert Bradshaw, 18.08.2010 20:47:
> On Wed, Aug 18, 2010 at 11:29 AM, Stefan Behnel wrote:
>> Robert Bradshaw, 18.08.2010 20:16:
>>> In terms of impacting user code, the only case it impacts is if people
>>> access __getattr__ by name. Is anyone doing that?
>>
>> Well, yes, look at the test case I added.
>
> It was a test in response to this regression :).
>
>> It's quite common to map
>> __getitem__ or __getattr__ on the other method respectively to provide
>> different interfaces for a class, e.g. to provide a __getitem__ fallback
>> for names that do not work as a Python identifier.
>
> I've never seen this, but could see that being justified.
>
>> You can also use the
>> unbound __getattr__ method to read a sequence of attributes.
>
> Would using the getattr builtin be a more natural way of doing this?
> Or is the point to skip the normal attribute lookup steps?

To be honest, I don't know. As I said, likely not the most common use case.

Another thing I forgot to mention is that Cython uses the lookup internally 
in two cases: when generating the __test__ dict and in the now modified 
module init code that sets up the docstrings. Both fail when __getattr__ 
cannot be found, thus preventing the module from being used at all if users 
have a docstring in their __getattr__ methods.


> Lets release 0.13 without this lookup regression/performance fix
> (depending on your point of view) and keep the discussion open for
> what to do for 0.13.1 (which, if it isn't out soon, may require a
> patched Cython for Sage.)

Based on previous experience, I think it'll be a lot easier to release a 
0.13.1 once 0.13 is out. ;)

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

Reply via email to