
Jan. 21, 2021
6:24 p.m.
On Fri, Jan 22, 2021 at 5:21 AM Neil Girdhar <mistersheik@gmail.com> wrote:
I've seen this proposed here before. The general idea is that some iterator transformations (like enumerate) should return sequences when they're applied to sequences. I think it's good idea, but it adds complexity and work, which I guess needs to be justified on a case-by-case basis.
In short, this has nothing to do with reversed. If you made enumerate return a sequence when its input is a sequence, you would also be able to do enumerate(some_list)[34], which could also be useful. I think it makes Python slightly more perfect and more beautiful.
list(enumerate(some_list)) will give you a sequence, if that's what you want. ChrisA