Proposed new syntax

Ian Kelly ian.g.kelly at gmail.com
Fri Aug 18 01:34:32 EDT 2017


On Thu, Aug 17, 2017 at 11:05 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
> On Fri, 18 Aug 2017 06:28 am, Ian Kelly wrote:
>> "while" implies a condition that is currently true and may at some
>> point stop being true. To me, that sequentiality does imply
>> proceduralness.
>
> For loops and comprehensions (in Python) are inherently procedural, so it's a
> good match. If you want to ignore the documented semantics of Python
> comprehensions, their fundamental similarities to generator expressions, and
> their actual behaviour, in order to say that they aren't procedural, that's
> okay, it a free planet. (Sometimes.)
>
> But if you do that, then logically you must also allow that "while" is likewise
> not procedural. Otherwise you're just showing a double-standard.

I explained my logic here. You say that logically "while" is likewise
not procedural, but you didn't explain what that logic is, so I have
no idea what you're referring to.


>> "for", to quote from Merriam-Webster, indicates "equivalence in
>> exchange". A precise definition seems hard to nail down, but there's
>> no such implication there.
>
>
> Webster 1913 includes well over a dozen definitions for the word "for", so I'm
> sure that Merrian-Webster would be similar. I don't know why you cherry picked
> that one definition out of so many.

"For" in the loop sense takes the meaning that it has in "for each"
(hence why we sometimes call it a for-each loop). This is the only one
that makes sense to me in that context.

> I think this is more appropriate:
>
>    8. Indicating the space or time through which an action or
>       state extends; hence, during; in or through the space or
>       time of.

The example phrase for that one is "gone for two days". I don't see
how you can possibly interpret this in the sense of a for-each loop.

> "for x in seq" indicates that x extends through the space of seq, in a manner of
> speaking.

No, given the definition above, it would indicate that something
extends through the space of x. Again, this makes zero sense to me.

> Or for something more recent, and more relevant, how about foldoc, the Free
> On-line Dictionary of Computing?

Completely misses the point of consulting the dictionary in the first
place. We were discussing the implications of the use of the English
definition. A technical computing definition is irrelevant.

> But if we can do that, we can likewise do the same for "while".

Okay, I'm waiting. What is your proposed "non-procedural" definition of "while"?

> You can't have it both ways:
>
> (1) if we can ignore the proceduralness of "for", then we can ignore the
> proceduralness of "while" and put it in a comprehension;
>
> (2) if we *cannot* ignore the proceduralness of "while", then we likewise cannot
> ignore the proceduralness of "for", therefore comprehensions are fundamentally
> procedural and that objection against "while" is neutered.

This claim is absurd. They're *different words* with different
definitions and entirely different connotations. They're not even the
same part of speech. You might as well be saying that if we can ignore
that "swim" is a color, then we can also ignore that "red" is a color.



More information about the Python-list mailing list