Indentation and grouping proposal

R Wentworth rhww at erols.com
Mon Jun 7 15:36:17 CEST 1999


Tim Peters wrote:
> 
> [R Wentworth, suggests "_(" and ")_" as alternative grouping constructs]
> 
> Note that this won't fly, since "_(" already has a meaning in the grammar
> (call the function whose name is _).

Actually, the suggested tokens were _{ and }_, with braces rather than
parentheses.  Admittedly braces and parenthesis can be hard to distinguish
on a computer screen.  I'm well aware that "_(" is syntactically legal and 
meaningful, and therefore not a candidate.

> > [careful argument & analysis deleted]
> > ...
> > I haven't looked at the Python parser, but naively, this sort
> > of "enhancement" would seem to be relatively easy.  If there were
> > official blessing for the concept, I'd be willing to look into
> > doing the necessary work.
> 
> Guido's last public word on the subject is in Tools/Scripts/pindent.py.

That's a nice tool, and one I wasn't aware of.  Could be applied to some
of the examples I cited, albeit awkwardly.  (And it doesn't allow a
1-line program, which is what I would want in some situations.)

> Go way back (pre-DejaNews; in python.org's archives, though), and you'll
> find some words, and even some patches to implement alternatives; e.g., see
> Donald Beaudry's
> 
>     http://www.python.org/search/hypermail/python-1994q2/0763.html

Interesting.  (Again, it isn't quite as general as what I was proposing,
and does not allow for 1-line programs.)

> The parser hasn't changed all that much since then, although it's likely
> changed a lot more than Guido's opinion <wink>.

So, I guess having this "blessed" is unlikely. :(

(I do suspect that the "embedding" issue is more important now than it was
five years ago, what with the rise of HTML templating systems and the like.
To my mind that makes the issue somewhat less frivolous.  Oh, well.)

> IIRC,

"IIRC" ?

> Steven Majewski christened the alternatives "frowning Guidos", in
> honor of everyone's favorite some 5 years ago:
> 
>     if whatever :(
>     print "no whitespace!" ):

Plausible, if inauspicious.

> or-was-that-"(:"-and-":)"?-ly y'rs  - tim

Bob




More information about the Python-list mailing list