#2377 new defect

replace 'cond and one or tother' idiom with 'one if cond or tother'

Reported by: daira Owned by: daira
Priority: normal Milestone: undecided
Component: code Version: 1.10.0
Keywords: cleanup Cc:
Launchpad Bug:

Description (last modified by daira)

In Python pre-2.5, the nearest equivalent to C's cond ? one : tother was the idiom cond and one or tother. In Python 2.5+, 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 Tahoe-LAFS requires at least Python 2.6, we can always use the latter.

("t'other" is Northern English dialect for "the other", if you were wondering about that.)

Change History (1)

comment:1 Changed at 2015-02-06T22:59:34Z by daira

  • Description modified (diff)
Note: See TracTickets for help on using tickets.