[Python-ideas] More classical for-loop
Mikhail V
mikhailwas at gmail.com
Fri Feb 17 15:33:36 EST 2017
On 17 February 2017 at 18:40, Chris Angelico <rosuav at gmail.com> wrote:
> Further discussion probably should be redirected to python-list, but
> I'll elaborate here to explain why I do not support your proposal.
>
I don't see why you want redirect me to python-list, and how
exactly do you see it, start a related discussion there?
> You have a shelf of books. I ask you to go through the books and read
> their titles out. How do you do it?
>
I think first I would suppose that probably I'll need
not all of the books, but say 20, or want to count something.
And that is life - if I want to batch process 100 movie files
obviously I'll first try to process one file. And then, if
all is ok, I'll uncomment the full loop line and comment out the
partial loop line.
It is not known how much percent of processing algorithms
does not require index *at all*. For me it is probably 20% or so.
I do math, all sorts of batch processings and even
in unexpected cases "for in range()" comes in handy, e.g:
D = {"a":5, "b":10, "c":15}
keys = D.keys()
d = len(D)
for i in range(0, d) :
key = keys[i]
print "progress:", i
So I'd say there is a big amount of cases where it is natural
and the proposal should not contradict with current usage,
but rather is a syntactic sugar for 'for in range()" which,
IMO has some purpose due to frequent usage, hence
there are some PEPs related to this.
Mikhail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170217/b64adea9/attachment.html>
More information about the Python-ideas
mailing list