Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41425
| Path | csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <laxmikant.general@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'else:': 0.03; 'elif': 0.04; 'welcome.': 0.07; 'cc:addr:python-list': 0.10; 'def': 0.10; "range'": 0.16; 'received:74.125.82.46': 0.16; "time'": 0.16; 'wrote:': 0.17; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply- To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'kumar': 0.29; 'subject:other': 0.29; 'subject:some': 0.29; 'url:mailman': 0.29; 'url:python': 0.32; 'url:listinfo': 0.32; 'received:74.125.82': 0.33; 'code:': 0.33; 'received:google.com': 0.34; 'subject:?': 0.35; 'received:74.125': 0.36; 'url:org': 0.36; 'skip:p 20': 0.36; 'subject:: ': 0.38; 'url:mail': 0.40; 'here': 0.65; 'forward': 0.66; 'subject:this': 0.84; 'transport,': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=DeHB1liIS+S3L+Uj+spUINXmVbhZWrimdq5Qh5qLVOw=; b=Wacdna13zD+qWlNIFkW7KbuI+qb1w25HQ9Z4Cus0HqcCPAA2m6V0k56U4kIMfbnCWh Aj1SbslXu8YpkNZL+R60SOu29xCJ0q81YSTaw1va3Poq3mEf4lU3fy2tDxI5Y7uQ1qZe jO3DhB3JM/Bx3tjM2MtlW4u8tYzgLD1yRXKf6VV6Jkq9HzPIMB2XAqgDOIBs9b0f8jpq o/6/Y30wpfHIQ7l/Ij63vt9mEUxLtLYJ2BCv9uQzZ7rGgbBSsXcdl40KBVjEbW2OUfaq d2P+k+QbMn+JeYvLg1NqSIUBlazb3E4XWpLsXaQpIzZNzcsAHq+lki+lU24sGI7Ctf5H iJ6g== |
| MIME-Version | 1.0 |
| X-Received | by 10.180.76.84 with SMTP id i20mr17105182wiw.9.1363616381405; Mon, 18 Mar 2013 07:19:41 -0700 (PDT) |
| In-Reply-To | <CAE7MaQabqa2DT6bfiq3Ju1Kfyq2dMLFvebk3ynFbZnHxTSqsHA@mail.gmail.com> |
| References | <CAE7MaQabqa2DT6bfiq3Ju1Kfyq2dMLFvebk3ynFbZnHxTSqsHA@mail.gmail.com> |
| Date | Mon, 18 Mar 2013 19:49:41 +0530 |
| Subject | Re: What are some other way to rewrite this if block? |
| From | Laxmikant Chitare <laxmikant.general@gmail.com> |
| To | Santosh Kumar <sntshkmr60@gmail.com> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| 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.3453.1363616383.2939.python-list@python.org> (permalink) |
| Lines | 30 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1363616383 news.xs4all.nl 6959 [2001:888:2000:d::a6]:35365 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41425 |
Show key headers only | View raw
What about this one: if 0.0 < should_be_on > 24.0 or 0.0 < came_on > 24.0: Regards, Laxmikant On 3/18/13, Santosh Kumar <sntshkmr60@gmail.com> wrote: > This simple script is about a public transport, here is the code: > > def report_status(should_be_on, came_on): > if should_be_on < 0.0 or should_be_on > 24.0 or came_on < 0.0 or > came_on > 24.0: > return 'time not in range' > elif should_be_on == came_on: > return 'on time' > elif should_be_on > came_on: > return 'early' > elif should_be_on < came_on: > return 'delayed' > else: > return 'something might be wrong' > > print(report_status(123, 12.0)) > > I am looking forward of make the line starting with `if` short. > > Any tips are welcome. > -- > http://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: What are some other way to rewrite this if block? Laxmikant Chitare <laxmikant.general@gmail.com> - 2013-03-18 19:49 +0530
csiph-web