Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41431
| From | Jussi Piitulainen <jpiitula@ling.helsinki.fi> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: What are some other way to rewrite this if block? |
| Date | 2013-03-18 16:53 +0200 |
| Organization | University of Helsinki |
| Message-ID | <qottxo8vjwg.fsf@ruuvi.it.helsinki.fi> (permalink) |
| References | <mailman.3444.1363614983.2939.python-list@python.org> <qotzjy0vlxc.fsf@ruuvi.it.helsinki.fi> <XnsA18795D8AD5C5duncanbooth@127.0.0.1> |
Duncan Booth writes:
> Jussi Piitulainen wrote:
>
> >> Any tips are welcome.
> >
> > A double tip:
> >
> > if (not (0.0 <= should_be_on <= 24.0) or
> > not (0.0 <= came_on <= 24.0)):
> > ...
> >
> Or even:
>
> if not (0.0 <= should_be_on <= 24.0 and 0.0 <= came_on <= 24.0):
> ...
I'd still prefer to split the line, especially considering the fact
that the request was to make the line shorter:
if not (0.0 <= should_be_on <= 24.0 and
0.0 <= came_on <= 24.0):
...
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
What are some other way to rewrite this if block? Santosh Kumar <sntshkmr60@gmail.com> - 2013-03-18 19:26 +0530
Re: What are some other way to rewrite this if block? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-03-18 16:10 +0200
Re: What are some other way to rewrite this if block? Duncan Booth <duncan.booth@invalid.invalid> - 2013-03-18 14:43 +0000
Re: What are some other way to rewrite this if block? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-03-18 16:53 +0200
Re: What are some other way to rewrite this if block? "Yves S. Garret" <yoursurrogategod@gmail.com> - 2013-03-18 07:18 -0700
Re: What are some other way to rewrite this if block? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-18 15:10 +0000
Re: What are some other way to rewrite this if block? Chris Angelico <rosuav@gmail.com> - 2013-03-19 02:24 +1100
csiph-web