[Python-Dev] A decorator syntax not yet mentioned (I think!) (original) (raw)
Simon Percivall s.percivall at chello.se
Wed Aug 11 17:30:04 CEST 2004
- Previous message: [Python-Dev] A decorator syntax not yet mentioned (I think!)
- Next message: [Python-Dev] A decorator syntax not yet mentioned (I think!)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2004-08-11, at 17.16, John Marshall wrote:
How about the following, which I am almost positive has not been suggested: ----- class Klass: def init(self, name): self.name = name
deco meth0: staticmethod def meth0(x): return x deco meth1: classmethod def meth1(cls): return cls deco sayhello: funcattrs(name='GvR', language='python') log(file='func.log') def sayhello(self): print 'hello python world' Any comments?
There is the problem that you have to repeat the name of the function you define. Repetition of this kind leads to error. It also takes more place and distracts more from the actual function than most of the other syntax. Also, there is the "new keyword" problem, leading to breakage if older code uses the "deco" name.
//Simon
- Previous message: [Python-Dev] A decorator syntax not yet mentioned (I think!)
- Next message: [Python-Dev] A decorator syntax not yet mentioned (I think!)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]