[Python-ideas] for/except/else syntax

Yuvgoog Greenle ubershmekel at gmail.com
Fri Oct 9 02:09:18 CEST 2009


On Thu, Oct 8, 2009 at 4:07 PM, George Sakkis <george.sakkis at gmail.com> wrote:
> Agreed. The more people disagree on how "for/else" should be spelled,
> the more I think there is no keyword that can encapsulate what it does
> unambiguously. Certainly "then" leaves me as clueless as "else" for
> the reasons above. I was thinking of something verbose like
> "elifnotbreak", but not only it is ugly, it is not 100% accurate; the
> correct spelling would be "elifnotbreakandnotreturnandnotexception" ;)

I agree with you on "then" giving no clues but I think you're wrong
about the spelling. The correct spelling would be "if not break".

    x = y / z
    if condition:
        print(1,2,3)

The above code translated to "George Sakkis Language" should be spelled:

    x = y / x
    if condition and notreturnandnotexception:
        print(1,2,3)

So because it's obvious that everything in python is under the
condition of "notreturnandnotexception", your point is moot.

The "else" in "for...break...else" is very simply a condition tested
after the loop finished (exactly like any other "if" that would
immediately follow the loop). The condition that's tested is simple:
"if there was a break - skip this".

So your spelling exaggeration doesn't worry me :). The fact that
python-ideas can't agree on a better syntax for python 4/5 does. I
appreciate the lesson taught, as Guido put it, but I think python can
have a long term plan concerning this old, rare and misleading syntax.

--yuv



More information about the Python-ideas mailing list