Py3K idea: why not drop the colon?

Hendrik van Rooyen mail at microcorp.co.za
Sun Nov 12 06:25:54 EST 2006


"Dan Lenski" <dlenski at gmail.com> wrote:


> Hendrik van Rooyen wrote:
> > "Fredrik Lundh" <fredrik at pythonware.com> wrote:
> >
> > 8<---------------------------------------------------
> > >  >>> color = "blue"
> > >  >>> if color == "red" or "green" or "yellow":
> > > ...     print color, "is red or green or yellow"
> > > ...
> > > blue is red or green or yellow
> >
> > *grin* - this can be construed as a weakness in Python -
> >
> > Even COBOL compilers in the sixties would "add in" the implied
> > "if color = " after each 'or', instead of bloody - mindedly thinking:
> 
> How the heck could this be considered a weakness in Python?  I *like*
> the fact that Python does not do anything "automagical" and rewrite
> expressions, thinking it's smarter than the programmer.  That's one
> reason I got sick of Perl.
> 
> There are plenty of cases where I might want to use an expression like
> "color == red or foo or bar" with the semantics it actually implies in
> Python.  Making an exception for literal strings specifically seems
> reallly dubious given the fact that Python already has an easy way to
> do what you want with the "color in (red, green, blue)" construct.
> This supposedly lacking feature would only be desired by people who
> have been brain-damaged by programming languages like BASIC and
> COBOL... or newbies who haven't programmed enough to really "get"
> Boolean logic.  </rant>
> 
> Dan

I am amazed by the reaction my grin and weakness comment has drawn - 
it looks as if both you and the effbot did not bother to read and try to 
understand the rest of that post, which gave an example of why the python
way is in fact good...

I apologise if my example is meaningless to people whose brains have not been
damaged by experience yet.

- Hendrik






More information about the Python-list mailing list