[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2377: replace 'cond and one or tother' idiom with 'one if cond or tother'
Tahoe-LAFS
trac at tahoe-lafs.org
Fri Feb 6 22:55:02 UTC 2015
#2377: replace 'cond and one or tother' idiom with 'one if cond or tother'
---------------------+---------------------------
Reporter: daira | Owner: daira
Type: defect | Status: new
Priority: normal | Milestone: undecided
Component: code | Version: 1.10.0
Keywords: cleanup | Launchpad Bug:
---------------------+---------------------------
In Python 2.5, the nearest equivalent to C's `cond ? one : tother` was the
idiom `cond and one or tother`.
In Python 2.6, a more precise equivalent is `one if cond else tother`.
The former is error-prone: it evaluates to `tother` when `one` is falsy,
which is the wrong thing. Since we now depend on Python 2.6, we can always
use the latter.
("t'other" is Northern English dialect for "the other", if you were
wondering about that.)
--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2377>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage
More information about the tahoe-lafs-trac-stream
mailing list