[Python-Dev] Another approach to decorators. (original) (raw)

Michel Pelletier michel at dialnetwork.com
Wed Aug 11 23:23:54 CEST 2004


On Wed, 11 Aug 2004 14:03:11 -0700 "Brett C." <bac at ocf.berkeley.edu> wrote:

I said:

> > class Foo: > > decorate static: > > def static1(blah...): > pass > > def static2(blah...): > pass > > To me, this idea looks more like Python than all the rest, and allows > you to consolidate related decorated methods and classes. Nest them to > apply decorators "aquisition style":

But then how are you supposed to do multiple decorators for the same method?

Put more than one of them in the same decorate block:

class ...

decorate staticmethod, locksFile(arg1):

def meth1(...)
  ...

def meth2(...)
  ...

I am with Martin that a keyword argument is not going to work here.

I presume you mean MvL and not the orginal poster, Martin Zarate.

Going that route leads to ``public static painInTheAssAndClutteredSyntax(That can) implements Lots, Of, Stuff, That throws Things, You, Can, Learn, From, The, Docs`` hell.

How does Martin Z's idea lead to this?

-Michel



More information about the Python-Dev mailing list