On 18 February 2017 at 05:43, Steven D'Aprano <st...@pearwood.info> wrote: > On Fri, Feb 17, 2017 at 06:31:19PM +0100, Mikhail V wrote: > >> I have said I need the index, probably you've misread my last comment. >> Further more I explained why I think iteration over index should be the >> preferred way, it help with readability a lot. > > Your concept of readability is clearly radically different from that of > the majority of the Python community. > > >> All my learning years ended up with rewriting most code to "for i in >> range()" > > How do you cope with generators and iterators that don't have a length? > > How do you cope with iterables which are infinite? > > >> and I slap myself when I start to write "for e in L". >> It is exactly where TOOWTDI applies perfectly and it is integer iteration >> for me. > > It sounds like Python is not a good match for the way you think. I don't > say that as a put-down, but perhaps you would be happier if you found > another language that works the way you would like, instead of trying to > force Python to be something it isn't? > > > -- > Steve
You mean what my proposal would bring technically better than e.g.: for i,e in enumerate(Seq) Well, nothing, and I will simply use it, with only difference it could be: for i,e over enumerate(Seq) In this case only space holes will be smoothed out, so pure optical fix. As for my comment about indexing preference- something inside me would push me to write something like: for i index Seq: e = Seq[i] One could call the second line 'noise', but I can't explain why, it helps me to read, and I am not biased to C style or anything. Also it probably has to do with variables names, and here I see it on the second line, note that it is not always 'e' and they often make sense, e.g. 'files', 'dirs'. Mikhail _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/