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


Groups > comp.lang.python > #29405

Re: 'indent'ing Python in windows bat

From Roy Smith <roy@panix.com>
Newsgroups comp.lang.python
Subject Re: 'indent'ing Python in windows bat
Date 2012-09-17 23:17 -0400
Organization PANIX Public Access Internet and UNIX, NYC
Message-ID <roy-042AE8.23175417092012@news.panix.com> (permalink)
References <mailman.3021.1347928001.27097.python-list@python.org> <5057C990.8080809@invtools.com> <mailman.854.1347937306.27098.python-list@python.org>

Show all headers | View raw


In article <mailman.854.1347937306.27098.python-list@python.org>,
 Ian Kelly <ian.g.kelly@gmail.com> wrote:

> On Mon, Sep 17, 2012 at 7:08 PM, David Smith <davids@invtools.com> wrote:
> > How do I "indent" if I have something like:
> > if (sR=='Cope'): sys.exit(1) elif (sR=='Perform') sys.exit(2) else
> > sys.exit(3)
> 
> How about:
> 
> if sR == 'Cope':
>     sys.exit(1)
> elif sR == 'Perform':
>     sys.exit(2)
> else:
>     sys.exit(3)
> 
> I don't really understand why you're trying to keep it all on one line.

sys.exit({'Cope':1, 'Perform':2}.get(sR, 3))

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


Thread

Re: 'indent'ing Python in windows bat Ian Kelly <ian.g.kelly@gmail.com> - 2012-09-17 21:01 -0600
  Re: 'indent'ing Python in windows bat Roy Smith <roy@panix.com> - 2012-09-17 23:17 -0400
  Re: 'indent'ing Python in windows bat Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 09:53 +0200

csiph-web