David LeBlanc wrote: > I am curious to know why the, what seems to me kludgy, "def x(): pass x = > (static|class)method(x)" syntax was chosen over a simple "staticdef x > ():..." or "classdef x ():..." def specialization syntax? That syntax hasn't been chosen yet; syntactic sugar for static and class methods, properties, slots, and other object types is still an area of ongoing research. The current implementation was created since it did not need an extension to the syntax: x=staticmethod(x) was syntactically correct even in Python 1.2 (which is the oldest Python version I remember). There have been numerous proposals on what the syntactic sugar should look like, which is one reason why no specific solution has been implemented yet. Proposals get usually discredit if they require introduction of new keywords, like "staticdef". The current favorite proposals is to write def x() [static]: pass or perhaps def x() [staticmethod]: pass In that proposal, static(method) would *not* be a keyword, but would be an identifier (denoting the same thing that staticmethod currently denotes). This syntax nicely extends to def x() [threading.synchronized, xmlrpclib.webmethod]: pass The syntax has the disadvantage of not applying nicely to slots. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4