A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2002-February/020014.html below:

[Python-Dev] syntactic sugar idea for {static,class}methods

[Python-Dev] syntactic sugar idea for {static,class}methods [Python-Dev] syntactic sugar idea for {static,class}methodsBarry A. Warsaw barry@zope.com
Tue, 12 Feb 2002 13:12:45 -0500
>>>>> "MH" == Michael Hudson <mwh@python.net> writes:

    MH> Some time ago, Gareth McCaughan suggested a syntax for
    MH> staticmethods.  You'd write

    MH> class C(object):
    |     def static(arg) [staticmethod]:
    |         return 1 + arg

    | C.static(2)
    |    => 3

Very interesting!  Why the square brackets though?  Is that just for
visual offset or is there a grammar constraint that requires them?
I'd leave them out of the picture, unless you mean to imply that a
list is acceptable in that position <wink>.

salt-and-pep-per-ly y'rs,
-Barry



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