PEP 289: universal and existential operators

Jess Austin austin at smartobject.biz
Wed Nov 5 04:38:41 EST 2003


python at rcn.com (Raymond Hettinger) wrote in message news:<5d83790c.0310231158.65595858 at posting.google.com>...
> Peter Norvig's creative thinking triggered renewed interest in PEP 289.
> That led to a number of contributors helping to re-work the pep details
> into a form that has been well received on the python-dev list:
> 
>     http://www.python.org/peps/pep-0289.html
> 
> In brief, the PEP proposes a list comprehension style syntax for....

Toward the end of the PEP, we have the following:

>The utility of generator expressions is greatly enhanced when
combined with >reduction functions like sum(), min(), and max().
Separate proposals are >forthcoming that recommend several new
accumulation functions possibly >including: product(), average(),
alltrue(), anytrue(), nlargest(), nsmallest().


This is great.  I'd like to request that alltrue() and anytrue() be
renamed forall() and exists(), repsectively.  It would allow:

def prime(x):
    return forall(x%y for y in xrange(2, math.sqrt(x)))

etc.  This is a an opportunity to be mathematically precise, and I
think we should be.  Python is going to have the universal and
existential operators in a very general syntax, so let's celebrate it
a little.

later,
Jess




More information about the Python-list mailing list