Possible PEP: Improve classmethod/staticmethod syntax

Gerrit Holl gerrit at nl.linux.org
Wed Jun 4 11:13:52 CEST 2003

Aahz schreef op woensdag  4 juni om 01:37:12 +0000:
> 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.

Why not:

    def mymethod(args)(staticmethod):
        blah, blah, blah

It is unambigious and I think it's more readable.

I don't see how properties would fit into any of these syntaxes
though, because the property() function takes multiple arguments.

40. He may sell field, garden, and house to a merchant (royal agents)
or to any other public official, the buyer holding field, house, and
garden for its usufruct.
        -- 1780 BC, Hammurabi, Code of Law
Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:

More information about the Python-list mailing list