Abstract and concrete syntax

John Roth newsgroups at jhrothjr.com
Wed Jun 8 22:17:10 EDT 2005


"David Baelde" <david.baelde at ens-lyon.fr> wrote in message 
news:pan.2005.06.09.01.32.11.164685 at ens-lyon.fr...
>
> Hi,
>
> I tried python, and do like it. Easy to learn and read (at least for the
> commonly used part), has a very large community so great doc and
> contributions, and... the design is clean. I come from functional
> programming languages, and I do like the proper static binding, the first
> class functions. That's what interests me in Python. It's the most modern
> of those addictive scripting languages.
>
> But, there is something I can't believe. Statements are not expressions. I
> tried to find some doc about that on the web. I'm not satisfied, and I'd
> like to learn more and discuss here.
>
> First, there are some trolls about Python Zen forbidding statements to be
> expressions. But I think the Zen is often contradictory. I don't like
> trolls, want something serious.
>
> Basically, I found one good point against statements-as-expressions: it
> cannot fit the indentation sensitive syntax.
>
> ---
> http://mail.python.org/pipermail/python-list/2005-January/260566.html
> Python allows statements inside suites and suites inside compound
> statements. It also allows expressions inside statements and expressions
> inside expressions. The one thing it never ever does is allow a suite or a
> statement inside an expression, because doing so would utterly destroy the
> handling of significant white space.
> ---
>
> I feel there are some real problems here. But I can't find anything
> absolutely unsolvable. I played a few examples, can't get anything
> ambiguous. Maybe the nesting analyzer
> (http://python.org/doc/2.4.1/ref/indentation.html) needs to take into
> account parenthesis-like delimiters together with indentation, but that
> doesn't look impossible (although I suspect it's harder than I can 
> imagine).
> The parenthesis trick could avoid over-deep indentation.
>
> set_callback(obj,
>             lambda x: (if a:
>               2
>             else:
>               3)
>
> Well, I suspect there are some moral issues, and maybe pythonists don't
> want statements in expressions.

There are a number of ways of doing it; I suspect that the BDFL
simply doesn't want it.

> PEP #308 was about having a ternary (?:)
> operator for expression level conditional, pythonists rejected it. I'd
> like to read more about the motivations of the vote.

Well, Guido has been against it from the start. He finally decided to
put it up to the community to vote on the appropriate syntax. As you
can imagine, there were a huge (well, a couple of dozen) different
syntax suggestions, so it was effectively impossible to get a majority
vote. Result: proposal killed permanently with a sham showing of
giving the community a say in it.

Unfortunately, I found out about Condorcet voting too late; by that
time the original tallies no longer existed so they could not be
reanalyzed.

> But I guess you'll have more to say on that subject...
> __
> David
> 




More information about the Python-list mailing list