PEP 308: "then" "else" for deprecating "and" "or" side effects

Steven Taschuk staschuk at telusplanet.net
Fri Feb 14 21:20:42 CET 2003


Quoth Christian Tismer:
> Erik Max Francis wrote:
  [... and & or ...]
> > They _are_ logical operators.  They just do their logical by returning
> > one of the objects, rather than a strict Boolean.  Other languages do
> > this, like Lisp; there's nothing inherently wrong with it.  It's also
> > way too entrenched to change now.  It's an example of a feature that I
> > don't often rely on, but even I, a champion of the Booleans PEP,
> > wouldn't think to change their behavior now.
> 
> That's fine with me. Note that I do not say that we
> should change and and or (ignore my words about
> future deprecation). Instead, we should not
> abuse them in a way that has nothing to do with an
> "and", like the "(a and [b] or [c])[0])" tricks

How do you feel about reading
	x /= y or 1
as "divide x by y, or by 1 if y sucks"?  (I admit this example is
somewhat cryptic; my real question is whether you find this
reading of 'or' natural.)

-- 
Steven Taschuk           |   ,\
staschuk at telusplanet.net | }<__`O=
                         |  '  "     Pleiosaur





More information about the Python-list mailing list