Possible PEP: Improve classmethod/staticmethod syntax

Aahz aahz at pythoncraft.com
Tue Jun 3 19:30:46 EDT 2003


In article <20030603164521903-0400 at braeburn.themorgue.org>,
Kevin Smith  <Kevin.Smith at sas.com> wrote:
>
>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).

No argument; Guido considers the current method experimental.  The
current front-runner for fixing this is to add function decorators:

    def myMethod(args) [staticmethod]:
        blah, blah, blah

staticmethod would be a callable object that would return the
replacement function object.  This would allow chained decorators.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you don't know what your program is supposed to do, you'd better not
start writing it."  --Dijkstra




More information about the Python-list mailing list