(test) ? a:b

Dan Stromberg drsalists at gmail.com
Fri Oct 24 19:20:30 CEST 2014


On Fri, Oct 24, 2014 at 1:38 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> I don't get why that's considered hard to read.

> So why is it hard to read when the index is a flag?
>
> value = [f, g][cond]()

It's clear to you, it's clear to me, but is it clear to everyone?  I
very much doubt it.

Also, you've gone to the trouble of def'ing two functions here - you
may as well do a function for the if/else.



More information about the Python-list mailing list