PEP 318 - Function Modifier Syntax

Just just at xs4all.nl
Tue Jun 10 13:34:37 EDT 2003


In article <mailman.1055261361.12074.python-list at python.org>,
 sismex01 at hebmex.com wrote:

> is downright confusing.  It might be taken to be more confusing
> than the alternate syntax:
> 
> >>> def VerySpecialFunction(a,b) [Synchronized, Memoized,
> Contract(pre,post)]:
>       ....
> 
> because the first uses "as", which is already known; otoh, the use
> of a list (or tuple) after the parameter list is unknown, so there's
> no previous reference to muddle things up.

Same here. Also, the fact that it looks like a list makes the definition 
quite easy in terms of a list.

  def foo(self) [a, b, c]:
      ...

This evaluates to

  def foo(self):
      ...
  for modifier in [a, b, c]:
      foo = modifier(foo)

(With the exception that the initial 'foo' and 'modifier' variables are 
not exposed.)

Just




More information about the Python-list mailing list