Re: [Python-ideas] More classical for-loop

2017-02-18 Thread Erik
On 18/02/17 19:35, Mikhail V wrote: 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

Re: [Python-ideas] More classical for-loop

2017-02-18 Thread Todd
On Feb 18, 2017 02:30, "Mikhail V" wrote: On 18 February 2017 at 04:13, Joao S. O. Bueno wrote: > I don't see the point in continuing this thread. How does this add to the syntax discussion? I was replying to Nicks quite vague comments which were

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Mikhail V
On 18 February 2017 at 04:13, Joao S. O. Bueno wrote: > You can still use range. Yes thats what I do, see my proposal > I don't see the point in continuing this thread. How does this add to the syntax discussion? I was replying to Nicks quite vague comments which were

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Steven D'Aprano
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

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Mikhail V
A short Meta-note: I see most people are bottom-replying and still many do top-reply, namely you Nick always do. I dont know if there is a rule, but it makes quite hard to manage/read post with mixed posting style. On 17 February 2017 at 23:51, Nick Timkovich wrote: > >

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread David Mertz
Iterating over range(len(collection)) is one of the worst anti-patterns in Python. I take great pains to slap my students who do that. On Feb 17, 2017 9:32 AM, "Mikhail V" wrote: > > On 17 February 2017 at 17:37, Chris Angelico wrote: > >> On Sat, Feb

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Chris Angelico
On Sat, Feb 18, 2017 at 4:31 AM, 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. Further discussion probably

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Mikhail V
On 17 February 2017 at 04:59, Chris Angelico wrote: > On Fri, Feb 17, 2017 at 2:13 PM, Mikhail V wrote: > > Common use case: > > > > L = [1,3,5,7] > > > > for i over len(L): > >e = L[i] > > > > or: > > > > length = len(L) > > for i over length: > >

Re: [Python-ideas] More classical for-loop

2017-02-17 Thread Sven R. Kunze
On 17.02.2017 04:59, Chris Angelico wrote: On Fri, Feb 17, 2017 at 2:13 PM, Mikhail V wrote: Common use case: L = [1,3,5,7] for i over len(L): e = L[i] or: length = len(L) for i over length: e = L[i] Better use case: for i, e in enumerate(L): I totally

Re: [Python-ideas] More classical for-loop

2017-02-16 Thread Chris Angelico
On Fri, Feb 17, 2017 at 2:13 PM, Mikhail V wrote: > Common use case: > > L = [1,3,5,7] > > for i over len(L): >e = L[i] > > or: > > length = len(L) > for i over length: >e = L[i] Better use case: for i, e in enumerate(L): ChrisA

[Python-ideas] More classical for-loop

2017-02-16 Thread Mikhail V
Here is a summary of my idea about for-loop. It focuses on readability and does not take in account possible technical nuances. This is my first attempt to write a full proposal and I suppose it is ok to post it here. Many things (readability) can raise opinion based dispute, so it is sort of my