A syntax idea for one-liners
Lulu of the Lotus-Eaters
mertz at gnosis.cx
Mon May 26 12:54:43 EDT 2003
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.
Exact implementation left to readers. Probably the last line will look
something like "exec transformed". I guess there wouldn't be any
huge harm in such a script being included in the standard distribution.
Yours, Lulu...
--
mertz@ _/_/_/_/_/_/_/ THIS MESSAGE WAS BROUGHT TO YOU BY:_/_/_/_/ v i
gnosis _/_/ Postmodern Enterprises _/_/ s r
.cx _/_/ MAKERS OF CHAOS.... _/_/ i u
_/_/_/_/_/ LOOK FOR IT IN A NEIGHBORHOOD NEAR YOU_/_/_/_/_/ g s
More information about the Python-list
mailing list