PEP 318 - Function Modifier Syntax

sismex01 at hebmex.com sismex01 at hebmex.com
Tue Jun 10 11:58:32 EDT 2003


> From: Courageous [mailto:jkraska at san.rr.com]
> Sent: Tuesday, June 10, 2003 10:52 AM
> 
> > Apart from the fact that the python user community is not by 
> > any approximation a subset of the LaTeX community, I find the
> > argument that 'as' is confusing because it is already used in
> > import statements or SQL pretty dubious -- 
> 
> As well, I. While it would be better on general principle to 
> find a better word, if no such word is forthcoming this particular
> use of 'as' isn't at all confusing to me. As you point out, 'as'
> is a high utility English word already. Users ought to be familiar
> with its inherit dynamicity. :)
> 
> C//
>

Yes, but computer languages do not benefit from having words
with multiple distinct meanings.  "as" is already used to import
words from other modules giving them a different identifier than
it's original:

>>> import compile from re as RxCompile

Given that this meaning for "as" is already known, how should
the following be read:

>>> def SpecialFunction(a,b,c) as Synchronized:
         ....

This might tell many a user that this definition of SpecialFunction
gives it an additional name, Synchronized, and not that the
Synchronized() modifier is applied to the function SpecialFunction.

Given that, this definition:

>>> def VerySpecialFunction(a,b) as Synchronized, Memoized,
Contract(pre,post):
       ....

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.

just an opinion.

-gca

pd: Please excuse this evil legalese. :-(
--

Advertencia:La informacion contenida en este mensaje es confidencial y
restringida, por lo tanto esta destinada unicamente para el uso de la
persona arriba indicada, se le notifica que esta prohibida la difusion de
este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
la transmision, favor de comunicarse con el remitente. Gracias.





More information about the Python-list mailing list