On Apr 27, 2009, at 1:50 PM, Stefan Behnel wrote:

> Robert Bradshaw wrote:
>> On Apr 26, 2009, at 9:04 AM, Dag Sverre Seljebotn wrote:
>>> Note that for STL iterators we also need *it rather than [0], so add
>>> "deref" to that list. Or possibly we just add * to Cython?
>>>
>>> We could then also move on to define the next builtin for C++  
>>> classes,
>>> which would translate like this:
>>>
>>> obj = next(it)
>>>
>>> would become
>>>
>>> cython.inc(it)
>>> obj = cython.deref(it)
>>
>> I could see supporting unary * as a native Cython operator (though
>> one would still want to be able to specify its type when operated on
>> a class overloading it).
>
> Note that there would be an ambiguity with PEP 3132, though.

Argh, I forgot about that PEP.

> We (and Pyrex) did pretty well without unary* for quite a while.  
> I'd be very careful with
> adding it now. Especially for something like iterators, i.e. a  
> concept that
> Python already has (even if it looks and works different in the two
> languages), and for which dereferencing is a totally unrelated  
> concept from
> a Python POV.

That's because x[0] was always the same thing as (*x), even if a bit  
uglier. I'm not not as enthusiastic about it now (though not yet for  
sure set against it either...)

- Robert

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

Reply via email to