[Cython] Two generators in one function

Robert Bradshaw robertwb at gmail.com
Thu Feb 14 06:29:48 CET 2013


This is due to the archaic --disable-function-redefinition flag.

On Mon, Feb 4, 2013 at 4:28 PM, David Roe <roed.math at gmail.com> wrote:
> Hi everyone,
> I ran into the following problem using Cython 0.17.4 (current version of
> Sage).
>
> If you try to compile a file with the following function in it:
>
> def test_double_gen(L):
>     a = all(x != 0 for x in L)
>     b = all(x != 1 for x in L)
>     return a and b
>
> you get errors from the Cython compiler about 'genexpr' being redefined.
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>
>
> def test_double_gen(L):
>     a = all(x != 0 for x in L)
>     b = all(x != 1 for x in L)
>              ^
> ------------------------------------------------------------
>
> cython_test.pyx:5:14: 'genexpr' already declared
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>
>
> def test_double_gen(L):
>     a = all(x != 0 for x in L)
>              ^
> ------------------------------------------------------------
>
> cython_test.pyx:4:14: Previous declaration is here
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>
>
> def test_double_gen(L):
>     a = all(x != 0 for x in L)
>     b = all(x != 1 for x in L)
>              ^
> ------------------------------------------------------------
>
> cython_test.pyx:5:14: 'genexpr' redeclared
>
> Are you currently only able to use one inline generator pre function?
> David
>
>
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel
>


More information about the cython-devel mailing list