Possible PEP: Improve classmethod/staticmethod syntax

Sean Ross sross at connectmail.carleton.ca
Thu Jun 5 20:59:12 EDT 2003


# version that is something like what you could do now
def foo():
       ...do stuff...
foo = compose(staticmethod,
                           synchronized,
                           lambda f: contract(f, pre, post))(foo)


# version with sugar
def foo() as static,
                     synchronized,
                     contract(pre,post):
        ...do stuff...

# different version with sugar
def foo() is static,
                   synchronized,
                   contract(pre,post):
        ...do stuff...

# version that started the discussion
def foo()[staticmethod,
               synchronize,
               contract(pre,post)]:
        ...do stuff...

# still other sugar
def foo() like static,
                      synchronized,
                      contract(pre,post):
        ...do stuff...



# teenage girl version ... <wink>
def SheWasLikeWhateverAndIWas() like OMyGod:
        ...do stuff...






More information about the Python-list mailing list