Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57210

Re: python -c commands on windows.

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; '(at': 0.04; 'insert': 0.05; 'subsequent': 0.05; 'ugly': 0.07; '"if': 0.09; '22,': 0.09; 'bash': 0.09; 'escape': 0.09; "(i'm": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'indent': 0.16; 'newline,': 0.16; 'tab': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'gets': 0.27; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; 'am,': 0.29; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; 'work.': 0.31; 'this.': 0.32; 'supposed': 0.32; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'explain': 0.39; 'quote': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; "you'll": 0.62; 'real': 0.63; 'line,': 0.68; 'more?': 0.84; 'subject:commands': 0.84; 'url:php': 0.85; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=ZcCBkHtE0nc3yywmqdhbyko+Vx3pnwzlw27pAmEksMU=; b=Xib4JbF9HGkD/ZxId98WJ6SDCd9oZ8wQ0WghEiDGFKGsVrBOOed0+3DD454eDCn0P8 0rzt697mxpAbwgCqjVWiAuoI7dLR59mWpxo4MoMI3hu4Abm0hNuucZlrCkjkW2zlYjIF YRbxDCJwjZuQY5p1ixpzA6JMeOo3NC3CX+fT0diTXC9QwHEy/MD0FbvzLi6Iw1BMF/DD 5Jk4K/q0M3mfHZckgHhW01dIjF+fLyb6+blsdp3kjf4K6KzqQP2H7s2J55Rz9+nGIJl7 7fcvd/2I71X0QCECTxe/4GUY9CHlInibVTURSji1V55vWIES6WtYtA/ZzCnsTopEoTtC mbVw==
MIME-Version 1.0
X-Received by 10.66.165.68 with SMTP id yw4mr4696640pab.135.1382390792055; Mon, 21 Oct 2013 14:26:32 -0700 (PDT)
In-Reply-To <1382390051.14804.36774153.32DD8EAD@webmail.messagingengine.com>
References <l443sd$er5$1@ger.gmane.org> <1382390051.14804.36774153.32DD8EAD@webmail.messagingengine.com>
Date Tue, 22 Oct 2013 08:26:31 +1100
Subject Re: python -c commands on windows.
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1324.1382390796.18130.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1382390796 news.xs4all.nl 16008 [2001:888:2000:d::a6]:57313
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:57210

Show key headers only | View raw


On Tue, Oct 22, 2013 at 8:14 AM,  <random832@fastmail.us> wrote:
> C:\>python -c a=1^
> More?
> More? print(a)
> 1

Note that you have to hit enter *twice* for this to work. (I'm not
sure why; the caret is supposed to escape the newline, but that
doesn't explain this. For all I know, it could be an ascended bug[1].)
Also, if you want to indent a subsequent line, you'll (obviously) have
to quote it (at least, if you use spaces; I don't know of a way to
insert a tab character), so this gets ugly REAL fast for conditionals:

C:\Python33>python -c "if True:"^
More?
More? " print(1)"^
More?
More? else":"^
More?
More? " print(2)"
1

Makes bash look pretty awesome!

ChrisA

[1] http://tvtropes.org/pmwiki/pmwiki.php/Main/AscendedGlitch

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: python -c commands on windows. Chris Angelico <rosuav@gmail.com> - 2013-10-22 08:26 +1100

csiph-web