PEP-308 a "simplicity-first" alternative

Bengt Richter bokr at
Wed Feb 12 23:56:42 CET 2003

On 11 Feb 2003 19:58:33 -0800, Paul Rubin <> wrote:

>"Terry Reedy" <tjreedy at> writes:
>> > I intensely dislike "x and y else z".  "Explicit is better than
>> > implicit" to me specifically means avoiding this type of cutesy
>> > overloading.
>> Do you intensely dislike it more or less than the current idiom "x and
>> y or z"?
>The current idiom is not something to like or dislike, since for some
>values of x and y, it's just plain incorrect.  Its existence as a
>widespread idiom is basically a bug.  The question we're discussing is
>whether to fix the bug or let it stand.  "x and y else z" is a
>proposed fix that I dislike for the reasons I explained.

My fix is
    x and {y} or z

meaning y is treated as True in logical expression context, but
retains its value for purposes of the expression value.

    x and {y} or {z}

is an optional variant for stylistic purposes.

Bengt Richter

More information about the Python-list mailing list