What meaning is "if k in [0, len(n_trials) - 1] else None"?

Chris Angelico rosuav at gmail.com
Sat Dec 3 19:31:46 EST 2016


On Sun, Dec 4, 2016 at 11:10 AM, Terry Reedy <tjreedy at udel.edu> wrote:
>> But the expression result isn't even used. So this is better written:
>
>
> matplotlib.pyplot.xlabel sets x-axis scaling, with no documented return
> value.
> http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.xlabel
> If, as seems reasonable to assume, it returns None, the value of the
> expression is 'None if x else None', which is to say, None.

Hardly matters what the return value is, given that the code ignores it.

ChrisA


More information about the Python-list mailing list