Expression can be simplified on list

Ben Finney ben+python at benfinney.id.au
Tue Sep 13 22:25:15 EDT 2016


Lawrence D’Oliveiro <lawrencedo99 at gmail.com> writes:

> On Tuesday, September 13, 2016 at 2:33:40 PM UTC+12, Ned Batchelder wrote:
> > Why do you object to the type conversion to bool?
>
> It would be better if all such conversions were explicit

Why? It's entirely unambiguous: the expression of an ‘if’ statement *can
only be* evaluated in a Boolean context. What else could the reader
reasonably expect?

-- 
 \        “When I was a baby I kept a diary. Recently I was re-reading |
  `\   it, it said ‘Day 1: Still tired from the move. Day 2: Everybody |
_o__)                  talks to me like I'm an idiot.’” —Steven Wright |
Ben Finney




More information about the Python-list mailing list