Possible PEP: Improve classmethod/staticmethod syntax
frobozz_electric at hotmail.com
Thu Jun 5 17:59:32 CEST 2003
"Kevin Smith" <Kevin.Smith at sas.com> wrote in message
news:20030605080122580-0400 at braeburn.themorgue.org...
> In <bbl189$fs9$1 at driftwood.ccs.carleton.ca> Sean Ross wrote:
> > Personally, I would like to see something like this:
> > def ManyFunctionAttributes() as static, contract(pre,post):
> > ...
> I'd go for this one. There is just something unpalatable about the 'def
> foo()[static]' syntax. That's just too much unnecessary and bizarre
> syntax for Python. But this 'as <tuple>' syntax seems to fit quite
I agree with the 'unpalatable' reaction to 'def foo()[static]'. To me, it
introduces unnecessary line noise. I should note that using the 'as <tuple>'
form was suggested on python-dev, back in February, by (I think) Greg Ewing.
(That was a very long thread.)
As for my class method suggestion:
that's stolen from Ruby. Although, I think I might still prefer
def foo() as classmethod:
(I imagine 'def foo() as class: ... ' could be misconstrued...)
Anyway, an interesting discussion. And, if you're interested in this topic,
check out the discussion from python-dev in February. You'll probably also
find the 'thunks' discussion interesting.
More information about the Python-list