>
> Good idea! +1, if it is done in the "cython" namespace:
>
> from cython import inc, dec
>
> Other "magic" functions are already like in the cython namespace (it's
> not a real module).
>
> 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)
>
As I said before, I prefer a Pythonic syntax for Cython.
So, deref() would be better in this case.
But, for all this and more, we need to define a default syntax.
Mixing syntax is a little weird and harder to use.
If we translate C++ syntax to Pythonic syntax, I think it will be
easier to use it.
So, if we gonna do it, many other functions will be added to the list.
I have some Ideas. Don't know if they are good. But it sounds like:
my_list = clist(int) #just an example
it = cython.get_begin_iterator(my_list)
while it != cython.get_end_iterator(my_list):
if something == cython.deref(it): #just a normal if
break
cython.inc(it)
So, we could get iterator fom many ways. Just like in STL.
It's just a simple idea I have in mind
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev