A syntax idea for one-liners

Paddy McCarthy paddy3118 at netscape.net
Tue May 27 13:44:17 EDT 2003


philh at cabalamat.org (phil hunt) wrote in message news:<slrnbd6r0j.3tq.philh at cabalamat.uklinux.net>...
> On Mon, 26 May 2003 12:54:43 -0400, Lulu of the Lotus-Eaters <mertz at gnosis.cx> wrote:
> >philh at cabalamat.org (phil hunt) wrote previously:
> >|>Now I like that idea, you could write a module with a short name that
> >|>when imported could read an option for the oneliner, transform then exec it.
> >|>
> >|>   python -e 'import L1' -L1 'if a: if b: c;; if d: e;;; f; h'
> >|
> >|Or better, have a python1L executable allowing you to write:
> >|
> >|   python1L 'if a: if b: c;; if d: e;;; f; h'
> >
> >And best still, just write an five line script called 'python1L' (or
> >whatever) whose first line is "#!/usr/bin/env python", and use that to
> >run your one liners with odd semicolon syntax.
> 
> Indeed, that's what I meant. ("Executable" meant the x flag 
> is set, it doesn't mean it contains binary machine code).

The syntax seems a little cumbersome for 3 or four levels of
indentation. how about a different scheme:
  * Use character ':' for one extra level of indentation.
  * Use character ';' to separate statements at the same level of
indentation.
  * Use another character, (or character pair), to denote one level of
de-dent.

As you can see, I couldn't think of the last character to use :-)

Cheers, Paddy.




More information about the Python-list mailing list