[Python-ideas] for/except/else syntax

Yuvgoog Greenle ubershmekel at gmail.com
Fri Oct 9 06:58:56 CEST 2009


I'm willing to drop it as well btw.

On Fri, Oct 9, 2009 at 5:28 AM, George Sakkis <george.sakkis at gmail.com> wrote:
> On Thu, Oct 8, 2009 at 8:09 PM, Yuvgoog Greenle <ubershmekel at gmail.com> wrote:
>
>> 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)
>
> Um, false analogy. The "condition" expression either doesn't raise an
> expression and it is evaluated in boolean context, or it does raise an
> exception and there is no value to evaluate. Or to put it otherwise,
> if "condition" evaluates to True, the hypothetical
> "notreturnandnotexception" is also True by definition.
>
> Regardless, even if I accepted that we don't need to emphasize the
> exception/return case,  I'd be -1 on abusing the "break" keyword to
> allow "if not break". Using three keywords to express a single case is
> a bad design smell IMO.
>
>> 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.
>
> The only improvement I could hope for python 4/5 was to drop this
> feature altogether. It's more trouble than it's worth; it saves a
> couple of lines at the cost of error-proneness and head scratching
> when reading other people's code and wondering "did he really mean
> this or did he misunderstand what for/else does ?". People often
> reject adding a do/while syntax with the argument that it can be
> already expressed as a loop-and-a-half, and I bet do/while is at least
> as common as for/else, probably more.
>
> George
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list