A syntax idea for one-liners

Peter Hansen peter at engcorp.com
Sun May 25 18:49:26 EDT 2003


Beni Cherniavsky wrote:
> 
> I've recently discovered a backward-compatible and relatively simple
> and elegant syntax for encoding arbitrary sets of python statements
> with different indentations in a single line.
> 
> A single semicolon separates statements at the innermost level.  So
> let's separate at outer levels with several semicolons.  E.g.::
> 
>     if a:
>         if b:
>             c
>         if d:
>             e
>     f
>     h
>
> could be written as::
 
Warning!  Warning!  Absolutely unreadable code alert!

>     if a: if b: c;; if d: e;;; f; h

(You're not serious, are you?  I checked, but it's not April 1st... ;-)

-Peter




More information about the Python-list mailing list