[Python-ideas] for/else syntax

Gerald Britton gerald.britton at gmail.com
Thu Oct 1 06:23:27 CEST 2009


Why single out for/while and leave out try?  It supports an else
statement in a similar fashion.

Honestly I think the syntax is fine as it is.  Once I grasped what it
did and why, I exploited it to great effect.  The syntax may be
unfamiliar
to programmers coming from other languages, but so what?  The same can
be said of every language on the planet.  (I felt like an idiot
when I started to learn Haskell).

FWIW, nothing in life is intuitive.  Absolutely nothing.  Everything
has to be learned, even the simplest things.  A baby has to learn how
to nurse and many struggle with that unintuitive process as well.  The
concept of what is "intuitive" is entirely in the eye of the beholder
and is effectively a non-concept.

-1.

On Wed, Sep 30, 2009 at 9:58 PM, Yuvgoog Greenle <ubershmekel at gmail.com> wrote:
> I wouldn't modify the way for/else behaves btw. I would either:
> 1. rename the "else" to something else for "for" and "while" loops
> 2. remove the syntax altogether. 2to3 or 3to4 can do this by changing a
> boolean before the "break" statement for example.
>
>> expectations of those unwilling to learn the language
>
> I can tell you I love python and of course many newcomers will/do too. I'm
> just noting that this might be a pimple worth popping.
>
> One more thing, I have to clear django's name as it doesn't have a for/else
> construct, it has a for/empty construct that was inspired by a popular
> for/else django template recipe entitled:
>>
>> "for" template tag with support for "else" if array is empty
>
> (thanks for pointing that out Karen)
> On Thu, Oct 1, 2009 at 4:35 AM, alex23 <wuwei23 at gmail.com> wrote:
>>
>> On Oct 1, 11:07 am, Yuvgoog Greenle <ubershme... at gmail.com> wrote:
>> > To make things worse, it's not that newcomers will say "hmm, what does
>> > this
>> > for/else thing do? lets look at the manual", they will mistakenly assume
>> > they understand what the construct means.
>>
>> -1 for modifying Python to meet the "intuitive" expectations of those
>> unwilling to learn the language.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> http://mail.python.org/mailman/listinfo/python-ideas
>
>
> _______________________________________________
> 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