[Python-Dev] Another decorator syntax idea (original) (raw)

barnesc at engr.orst.edu barnesc at engr.orst.edu
Sat Aug 7 02:38:27 CEST 2004


Another decorator syntax idea

Using Guido's example:


@ Symbols

class C(object):

@staticmethod
@funcattrs(grammar="'@' dotted_name [ '(' [arglist] ')' ]", \
           status="experimental", author="BDFL")
def longMethodNameForEffect(longArgumentOne=None,
                            longArgumentTwo=42):
    """This method blah, blah.

    It supports the following arguments:
- longArgumentOne -- a string giving ...
    - longArgumentTwo -- a number giving ...

blah, blah.

"""
    raise NotYetImplemented

decorate keyword

class C(object):

def longMethodNameForEffect(longArgumentOne=None,
                            longArgumentTwo=42):
    decorate:
        staticmethod
        funcattrs(grammar="'@' dotted_name [ '(' [arglist] ')' ]", \
                  status="experimental", author="BDFL")]
    """This method blah, blah.

    It supports the following arguments:
- longArgumentOne -- a string giving ...
    - longArgumentTwo -- a number giving ...

blah, blah.

"""
    raise NotYetImplemented

Pros:

Cons:



More information about the Python-Dev mailing list