PEP 318 - Function Modifier Syntax

Just just at xs4all.nl
Tue Jun 10 16:58:25 EDT 2003


In article <87u1ax3c53.fsf at cassandra.evansnet>,
 Tim Evans <t.evans at paradise.net.nz> wrote:

> Another alternative, that someone brought up last time this discussion
> took place, was:
> 
> 
>     def spam(cls, x, y) becomes classmethod:
>         ...
> 
> I think that 'becomes' quite neatly expressed that the modifiers are
> added later, so the method is defined, and then becomes a class
> method.

The problem I have with most alternate suggestions, is that it's 
specific to the typical examples (classmethod, staticmethod). However, 
it's a _general_ function (and class, as far as I'm concerned) 
post-processing construct, and the keyword (if any) that introduces it 
should be fairly general. I think 'as' isn't all that bad here, but I 
still prefer the list notation.

Just




More information about the Python-list mailing list