Possible PEP: Improve classmethod/staticmethod syntax

Michele Simionato mis6 at pitt.edu
Wed Jun 4 12:27:35 EDT 2003


Kevin Smith <Kevin.Smith at sas.com> wrote in message news:<20030603164521903-0400 at braeburn.themorgue.org>...
> The current way of declaring a method to be a class method or a static 
> method leaves much to be desired.  While it is flexible in the sense 
> that new types of method modifiers can be created without any 
> syntactical backwards incompatibilities, it just isn't that user-
> friendly (and, in turn, not Pythonic).
> 
> A new proposed syntax for method modifiers is as follows:
> 
>     def classmethod foo(cls):
>         <code goes here>
> 
>     def staticmethod bar():
>         <code goes here>
> <snip>

You may be interested in googling for the old thread 
"extending the syntax for classes, too". I must say that 
now I favor the bracket syntax (in that thread I was favoring
def foo(cls) is classmethod).

                                        Michele




More information about the Python-list mailing list