Possible PEP: Improve classmethod/staticmethod syntax

Bryan belred1 at yahoo.com
Wed Jun 4 00:09:33 EDT 2003


> staticmethod is not a replacement function object, it *returns* a
> replacement function object for myMethod.  That is, the object bound to
> myMethod (*not* "myMethod()") is passed to staticmethod, and staticmethod
> returns an object that is re-bound to myMethod.  You are correct that
> staticmethod is not a keyword, any more than "str", "list", "len", or
> "myMethod" are keywords -- that is in fact the whole point of this
> proposal, because it requires no new keywords and a minimal change to
> the Python parser.
>

ok, i understand what you mean now.  but, in a way, it seems that we are
playing symantec games here. from a programmers prespective, it looks and
feels like a keyword.

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

style 2:
def staticmethod myMethod(args):
    blah, blah, blah


these two "styles" appear to be the same, except the second one seems to be
more natural and simpler and obvious to me. the first one looks like "the
function is becoming an array or indexed or something... not sure exactly
what those [] mean... better look it up in that nutshell book....".   sorry,
but i have to vote -1 on style one, +1 on style 2, +0 keeping it the way it
is.

bryan







More information about the Python-list mailing list