[Python-ideas] Consider making enumerate a sequence if its argument is a sequence

Neil Girdhar mistersheik at gmail.com
Wed Sep 30 17:28:10 CEST 2015


What are the pros and cons of making enumerate a sequence if its argument 
is a sequence?

I found myself writing:

                for vertex, height in zip(
                        self.cache.height_to_vertex[height_slice],
                        range(height_slice.start, height_slice.stop)):

I would have preferred:

                for height, vertex in enumerate(
                        self.cache.height_to_vertex)[height_slice]:


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150930/a8d7317d/attachment.html>


More information about the Python-ideas mailing list