PEP 318 - Function Modifier Syntax
hellen at claggetts.net
Tue Jun 10 23:46:29 CEST 2003
Roman Suzi <rnd at onego.ru> wrote:
> the syntax is confusing, because "as" already has a meaning of
> "to be known as":
> import string as s
> from string import split as sp
How about overloading the keyword "is" instead of "as"? As far as
English readability is concerned, this might be clearer. "Is" also
fits in well with established OO terminology (e.g., a square is a
rhombus, a function is a static method).
def func(x) is staticmethod:
def func(x) is cached, synchronized(lock):
Using "is" here could even conceivably lend itself to using the "is"
expression to determine the qualities of a method.
if func is staticmethod: print "it's static"
Just a thought,
PS. Of course, looking to a highly context sensitive (and downright
weird) language like English for ideas is just begging for trouble ;-)
More information about the Python-list