PEP 318 - Function Modifier Syntax
Ian Bicking
ianb at colorstudy.com
Wed Jun 11 16:10:25 EDT 2003
On Wed, 2003-06-11 at 07:02, Kevin Smith wrote:
> In <3EE67C20.941FCA51 at alcyone.com> Erik Max Francis wrote:
> > A fair point. So if you were able to choose any keyword for this task
> > that you wished, which would you choose?
>
> I had considered the word 'using' instead of 'as'. Someone else in this
> thread also suggested that. Then the the following def:
>
> def foo(self) using classmethod, synchronized(lock):
> blah, blah, blah
>
> reads as:
>
> "Define [a function] foo using [the behaviors of] classmethod and
> synchronized"
It's doesn't match the implementation, though (which I think is bad,
because I think the implementation is simpler than what you describe).
This implies that functions know about what it means to be a
classmethod, or to be synchronized. They don't -- classmethod knows how
to take a function and create a classmethod object, synchronized knows
how to take a function and wrap it with locks. The original function is
no longer accessible.
Ian
More information about the Python-list
mailing list