How to use "while" within the command in -c option of python?

Joshua Landau joshua.landau.ws at gmail.com
Sat Oct 13 18:16:27 EDT 2012


On 13 October 2012 23:09, Chris Angelico <rosuav at gmail.com> wrote:

> On Sun, Oct 14, 2012 at 9:00 AM, Joshua Landau
> <joshua.landau.ws at gmail.com> wrote:
> > That is also callable from the command-line like so:
> >>
> >> python -m debrace -c "if a: ${ print(1) $ print(2) $ while b: c() $ if
> g:
> >> ${ pass }$ }$ print(d)"
>
> Wait.... you're pretty much implementing from __future__ import braces?
>

But *without changing Python*. The Python that's run is brace-less. This is
a *pure module* and thus none of this will occur inside code, just in its
generation or on the command line.

Unless you want to use it on all of your files, in which case you're better
off with another language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20121013/d706787d/attachment.html>


More information about the Python-list mailing list