PEP-308 a "simplicity-first" alternative

Terry Reedy tjreedy at udel.edu
Wed Feb 12 10:19:34 EST 2003


"Paul Rubin" <http://phr.cx@NOSPAM.invalid> wrote in message
news:7xof5icfpy.fsf at ruckus.brouhaha.com...
> "Terry Reedy" <tjreedy at udel.edu> 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.

For some values of x, 'math.sqrt(x)' is also incorrect (but it does
raise an exception).
The correct idiom is to only use the construction when is is correct

>  Its existence as a widespread idiom is basically a bug.

The idiom is a straightforward consequence of Python's rules for 'and'
and 'or', which many people have independently discovered and put to
use.  Whether it is good usage or a bug is something we at least
somewhat disagree on.  But that is a different discussion.

>The question we're discussing is  whether to fix the bug or let it
stand.

Exactly.

>  "x and y else z" is a
> proposed fix that I dislike for the reasons I explained.

Ok.  I am quite willing to continue using and/or unless and until
there is an alternative that works even better and that does not
strike me as being ugly.  That will only happen when a 'substantial
number' + 1 agree on something.

Thanks for responding.

Terry J. Reedy






More information about the Python-list mailing list