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

Alexander Belopolsky alexander.belopolsky at gmail.com
Wed Sep 30 20:22:29 CEST 2015


On Wed, Sep 30, 2015 at 11:28 AM, Neil Girdhar <mistersheik at gmail.com>
wrote:

> 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]:
>

This does not seem to be an big improvement over

                for height, vertex in enumerate(
                        self.cache.height_to_vertex[height_slice],
height_slice.start):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150930/a23dd9b5/attachment.html>


More information about the Python-ideas mailing list