Re: Why don't we call the for loop what it really is, a foreach loop?
On Wed, 14 Sep 2016 22:01:34 -0700, Paul Rubin wrote: > Travis Griggs writes: >> for each in ['cake'] + ['eat', 'it'] * 2: >> print(each) > > https://pbs.twimg.com/media/Cr-edT2VUAArpVL.jpg the "Cowboy Song" buy Furrokh Bulsara -- Olmstead's Law: After all is said and done, a hell of a lot more is said than done. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
Christian Gollwitzer writes: > http://www.azlyrics.com/lyrics/queen/bohemianrhapsody.html Alt version, https://www.youtube.com/watch?v=hpvlTVgeivU -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
Christian Gollwitzer : > More interestingly, which language is it? First I thought C++ or Java, > but they don't use self and there is a => operator. PHP adornes > variables with $. Another C-derived language which has built-in hash > maps? C#. The => syntax is Python's lambda. Marko -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
Am 15.09.16 um 07:01 schrieb Paul Rubin: Travis Griggs writes: for each in ['cake'] + ['eat', 'it'] * 2: print(each) https://pbs.twimg.com/media/Cr-edT2VUAArpVL.jpg http://www.azlyrics.com/lyrics/queen/bohemianrhapsody.html More interestingly, which language is it? First I thought C++ or Java, but they don't use self and there is a => operator. PHP adornes variables with $. Another C-derived language which has built-in hash maps? Christian -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
Travis Griggs writes: > for each in ['cake'] + ['eat', 'it'] * 2: > print(each) https://pbs.twimg.com/media/Cr-edT2VUAArpVL.jpg -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
> On Sep 13, 2016, at 13:57, rgrigo...@gmail.com wrote: > > It would help newbies and prevent confusion. for each in ['cake'] + ['eat', 'it'] * 2: print(each) -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On Tuesday, September 13, 2016 at 9:57:38 PM UTC+1, Richard Grigonis wrote: > It would help newbies and prevent confusion. I entirely agree. All together now "foreach is a jolly good fellow...". Kindest regards. Mark Lawrence. -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On Wed, 14 Sep 2016 06:57 am, rgrigo...@gmail.com wrote: > It would help newbies and prevent confusion. No it wouldn't. Claims-which-are-made-without-evidence-can-be-rejected-without-evidence-ly y'rs, -- Steve -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On 13/09/2016 22:20, Ian Kelly wrote: On Tue, Sep 13, 2016 at 2:57 PM, wrote: It would help newbies and prevent confusion. Ada uses "for". C++11 uses "for". Dart uses "for". Go uses "for". Groovy uses "for". Java uses "for". JavaScript uses "for". MATLAB uses "for". Objective-C uses "for". Pasceal uses "for". Perl moved from "foreach" to just "for" in Perl 6. Ruby uses "for". Scala uses "for". Swift uses "for". And Fortran uses "do". My own language uses "for", "forall" and "foreach". (Apparently PHP also has a choice, according to another post.) "for" only iterates over an integer sequence. "forall" over the values in an object (such as a list), similar to Python. (And "foreach" breaks apart certain kinds of object, such as the bits in an integer, and iterates over those). Probably "for", "forall" and "foreach" could be combined (perhaps with a conversion to drive the the kind of iteration desired), but I think it's useful to see "for" and /know/ it's a basic loop. It also makes it easier to optimise, as well as allowing a stripped-down version that only counts, or repeats forever). Value Iterates over: For: Forall: Foreach: 1..3 1,2,31,2,3 -- (10,20,30)1,2,310,20,30 -- "ABC" 1,2,3"A","B","C" 65,66,67 (works with both) 100 0,1,2...63 --0,0,1,0,0,1,1,0,...0 Getting back to Python, it only has one kind of for-loop and it has decided to call it "for". It's just one minor thing (among many) that has to be learned. -- Bartc -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On 2016-09-13, Ian Kelly wrote: > On Tue, Sep 13, 2016 at 2:57 PM, wrote: >> It would help newbies and prevent confusion. > > Ada uses "for". [a dozen or so other langages] > Swift uses "for". > > Why do you think it's confusing that Python uses the same keyword in > its foreach loops that all the above languages do? What mistake is > this causing newbies to make? One might guess that the OP is coming from PHP where there are separate "for" and "foreach" looping constructs, and Python's "for" is analogous to PHP's "foreach". That said, I despise PHP so thoroughly that "because PHP does it" is, to me, a pretty strong argument for _not_ doing something. Even trying to ignore my bias agains PHP, I can't see that Python's calling it "for" instead of "foreach" is going to confuse anybody with a PHP background... -- Grant Edwards grant.b.edwardsYow! I have accepted at Provolone into my life! gmail.com -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On Tue, Sep 13, 2016 at 2:57 PM, wrote: > It would help newbies and prevent confusion. Ada uses "for". C++11 uses "for". Dart uses "for". Go uses "for". Groovy uses "for". Java uses "for". JavaScript uses "for". MATLAB uses "for". Objective-C uses "for". Pasceal uses "for". Perl moved from "foreach" to just "for" in Perl 6. Ruby uses "for". Scala uses "for". Swift uses "for". Why do you think it's confusing that Python uses the same keyword in its foreach loops that all the above languages do? What mistake is this causing newbies to make? -- https://mail.python.org/mailman/listinfo/python-list
Re: Why don't we call the for loop what it really is, a foreach loop?
On Tue, Sep 13, 2016 at 4:57 PM, wrote: > It would help newbies and prevent confusion. Are you asking why Guido didn't call it foreach back in 1989, or why the core developers don't change it now, 27 years later? I can't speak for the historical perspective, but I'm sure there's basically no chance that it will be changed now. It would be a totally backwards incompatible change, invalidate every tutorial and bit of python documentation that's been written over the last three decades, and break pretty much every python program that works today. In exchange, you get newbies who are a slightly less confused about for loops. That tradeoff isn't worth it. -- Jerry -- https://mail.python.org/mailman/listinfo/python-list
Why don't we call the for loop what it really is, a foreach loop?
It would help newbies and prevent confusion. -- https://mail.python.org/mailman/listinfo/python-list