Framework for a beginner

Chris Angelico rosuav at gmail.com
Thu Apr 19 09:20:44 EDT 2012


On Thu, Apr 19, 2012 at 10:56 PM, lkcl luke <luke.leighton at gmail.com> wrote:
> i'm belabouring the point (not entirely intentionally) but you see how
> clumsy that is?  it's probably just as complex in the actual
> lexer/grammar file in the http://python.org source code itself, as it
> is to think about in real life and to psychologically parse in
> english.  you actually have to think *backwards*!
>
> is that clearer, or have i added mud? :)

No, that's clear, and it is a very good point. There are several
language constructs that "feel backwards" to me, and have a somewhat
clunky feel as a consequence.

Perl has the "unless" keyword, putting the code before the condition:
die("Must use either foo or bar") unless $foo or $bar;

Python has the ternary operator, putting the if-true value before the condition:
foo = 5 if bar else 7

REXX has all variables global, unless you use PROCEDURE, in which case
all variables are local except ones that you explicitly EXPOSE.

functionname: procedure expose foo bar

They're all design decisions that would now be roughly impossible to
change. You simply accept that they exist, and code accordingly.
*shrug*

ChrisA



More information about the Python-list mailing list