[Python-Dev] Adding start to enumerate()
Nick Coghlan
ncoghlan at gmail.com
Tue May 13 11:40:57 CEST 2008
Terry Reedy wrote:
> "Nick Coghlan" <ncoghlan at gmail.com> wrote in message
> news:4828C59B.8070008 at gmail.com...
> | I'd like to hear from Raymond before we do this. I'm pretty sure we had
> | a reason for *not* doing it that way in when enumerate() was added, but
> | I can't remember what that reason might have been...
>
> http://bugs.python.org/issue2831
Thanks. I think this part is the main reason I see a start argument to
enumerate as potentially problematic:
"""all variants can easily be misread as starting at the nth item in the
sequence (much like islice() does now): enumerate(3, 'abcdefg') -->
(3,'d') (4,'e') (5, 'f') (6, 'g')."""
Is the need to use zip(count(3), seq) for the offset index case really
such a burden given the associated benefits in keeping the builtin
function really simple and easy to understand?
Cheers,
Nick.
--
Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
More information about the Python-Dev
mailing list