[Cython] Bug report: enumerate does not accept the "start" argument

Stefan Behnel stefan_ml at behnel.de
Tue May 8 09:37:00 CEST 2012


Russell Warren, 08.05.2012 08:25:
> Python's built-in function 'enumerate' has a lesser-known 2nd argument that
> allows the start value of the enumeration to be set.  See the python docs
> here:
> http://docs.python.org/library/functions.html#enumerate
> 
> Cython 0.16 doesn't like it, and only allows one argument.
> 
> Here is a simple file to reproduce the failure:
> 
> for i in enumerate("abc", 1):
>>     print i
> 
> 
> And the resulting output complaint:
> 
> Error compiling Cython file:
>> ------------------------------------------------------------
>> ...
>> for i in enumerate("abc", 1):
>>                  ^
>> ------------------------------------------------------------
>> deploy/_working/_cython_test.pyx:1:18: enumerate() takes at most 1 argument

Thanks for the report, here is a fix:

https://github.com/cython/cython/commit/2e3a306d0b624993d41a02f790725d8b2100e57d


> I have requested a trac login to file bugs like this, but the request is
> pending (just sent).

Please file it anyway (when you get your account) so that we can document
in the tracker that it's fixed.

Stefan


More information about the cython-devel mailing list