PEP 318

Terry Reedy tjreedy at
Tue Mar 23 15:34:06 CET 2004

"Michele Simionato" <michele.simionato at> wrote in message
news:95aa1afa.0403222352.2679dde at

> def __mul__(self,other) as multimethod(Vector,Scalar):
[et cetara]

This PEP proposes somewhat implicit declarative syntax in the function
heading as a substitute (but not replacement) for an explicit procedural
call after the function call.  This is similar to the doc string rule, and
just as 'unnecessary'.  However, if instead of writing

def f():
  'f: a function to illustrate a point'

we had to write

def f():

f.__doc__ = 'f: a function to illustrate a point'

(as we now can), I suspect there would be fewer doc strings written.  Even
if not, they would be less useful to readers.  I see the point of the PEP
at putting information about a function at the top so readers can more easy
see it before reading the body, if indeed they need to read the
implementation detail.  So I suspect the result of this PEP would be more
functional transformations than at present.  It certainly emphasizes the
point that Python functions are first-class objects which can be
manipulated and wrapped just like other objects.

I consider this a positive, but have no strong opinion on '(args) [deco]'
versus 'as deco'.

Terry J. Reedy

More information about the Python-list mailing list