[Cython] Problem with multiple assignment
Stefan Behnel
stefan_ml at behnel.de
Tue Jul 22 16:05:42 CEST 2008
Dag Sverre Seljebotn wrote:
> The way I visioned it it would turn into
>
> cdef object tmp
> ..
> tmp = False
> a = tmp
> b = tmp
What about this code:
cdef int i
cdef float f
cdef object o
o = i = f = 1
I think the current way to split the assignments and handle them
separately isn't bad at all. This gives us the pretty code for my example.
> However I suppose I could handle "rhs is a simple NameNode referring to
> something which is not in the global module dict etc etc" as an
> optimizezable special case which would give
>
> a = False
> b = False
That's most likely something that the C compiler would do anyway, but that
aside, there already is some special handling code for True, False and
None that should be easy to adopt here. I think doing the same thing in
the case of cascading assignments is the right fix for now.
Stefan
More information about the Cython-dev
mailing list