Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32592
| Path | csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <naruto0.1@live.cn> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.038 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'alter': 0.09; "(it's": 0.16; 'branch:': 0.16; 'parentheses:': 0.16; 'pythonic': 0.16; 'readable': 0.16; 'traverse': 0.16; 'wrote:': 0.17; 'element': 0.17; 'stick': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '???': 0.27; 'colon': 0.29; 'zero': 0.33; 'to:addr :python-list': 0.33; 'everyone': 0.33; 'list': 0.35; 'said,': 0.35; 'received:192.168.0': 0.35; 'something': 0.35; 'really': 0.36; 'but': 0.36; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'most': 0.61; 'more': 0.63; 'instantly': 0.93 |
| X-Originating-IP | [121.229.152.88] |
| X-EIP | [uU+dIDJ94YvFFNzFPQ/Cdz9Yid9LSrw9] |
| X-Originating-Email | [naruto0.1@live.cn] |
| Date | Fri, 2 Nov 2012 15:14:32 +0800 |
| From | jack <naruto0.1@live.cn> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: pythonic way |
| References | <CAFqGZREfq7fO4Okf1Oj9HBeUkWLYK_9=ho8N47_kyTKudGZSFA@mail.gmail.com> <CANaSqUfRdHoeUzcmAsmaK2WBgbXH63ZDu0pg2ebEX8APKkNwaw@mail.gmail.com> |
| In-Reply-To | <CANaSqUfRdHoeUzcmAsmaK2WBgbXH63ZDu0pg2ebEX8APKkNwaw@mail.gmail.com> |
| Content-Type | text/plain; charset="UTF-8"; format=flowed |
| Content-Transfer-Encoding | quoted-printable |
| X-OriginalArrivalTime | 02 Nov 2012 07:14:21.0091 (UTC) FILETIME=[AE01E730:01CDB8C9] |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3176.1351840531.27098.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351840531 news.xs4all.nl 6870 [2001:888:2000:d::a6]:34265 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32592 |
Show key headers only | View raw
Sometimes, I need to alter the element as traverse a list like this
(it's a sample):
c = range(10)
i = 0
for ele in c:
# do something
# branch:
c[i] = # value
i += 1
How to be pythonic?
2012/11/2 0:54, Zero Piraeus :
> :
>
> On 1 November 2012 11:32, inshu chauhan <insideshoes@gmail.com> wrote:
>> what is the most pythonic way to do this :
>>
>> if 0 < ix < 10 and 0 < iy < 10 ???
> As everyone else has said, it's perfectly pythonic once you stick the
> colon on the end. You might find it more instantly readable with some
> extra parentheses:
>
> if (0 < ix < 10) and (0 < iy < 10):
> # do something
>
> ... but that's really just down to taste.
>
> -[]z.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: pythonic way jack <naruto0.1@live.cn> - 2012-11-02 15:14 +0800
csiph-web