[Python-ideas] for/except/else syntax

Gerald Britton gerald.britton at gmail.com
Fri Oct 9 02:12:31 CEST 2009

The thing is, if you read the documentation, it is not misleading.  It
does just what it says it does.  The problem Guido identified, is that
too many folks don't read the documentation, but try to figure it out
by reading examples.  Small wonder they get confused!

On Thu, Oct 8, 2009 at 8:09 PM, Yuvgoog Greenle <ubershmekel at gmail.com> wrote:
> 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
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas

Gerald Britton

More information about the Python-ideas mailing list