PEP 318 - Function Modifier Syntax

Michael Chermside mcherm at
Tue Jun 10 18:42:08 CEST 2003

Alexander Schmolck:
>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. :)

Yeah, me too. Python, which strives to be "executable pseudocode", has many
instances where its statement syntax and keywords are chosen so as to make
the resulting code "read like english". Witness the following:

   import Foo as Bar
   from Foo import foo
   for x in iterable
   value in iterable  # okay, this one's an expression

I find that

   def name() as cached:

Easily translates mentally as "Define 'name' as being cached, and working
like this..", which is exactly what it means.

And others may feel differently, but I don't find any confusion between
"as" in the import statement and "as" with def. In both cases, it is
pretty clear that "as" isn't its own thing, it's just a helper word
explaining details of how to import or how to define a function.

-- Michael Chermside

More information about the Python-list mailing list