Ames Andreas (MPA/DF)
Andreas.Ames at tenovis.com
Fri Aug 6 11:57:33 CEST 2004
thanks for your help.
Terry Reedy wrote:
> That particular syntax -- deco in parens and jammed up against was
> never proposed. A similar syntax -- no parens and a space was.
> Guide said a) he thought there would be parser issues and b) this
> would cause problems with all support tools that assume that the
> next name after def is the function name.
I just found this style appropriate because it thus looks like a
parameter to "def", which it, the decorator, somehow is, if I
understand correctly. The same could be done to "class", but
unfortunately not to (instance) variables(, because they have no
keyword for declaration). I could even imagine
self.i<deco3> = "foo"
and yes, I'm coming from a C/C++ background, if you haven't realized
yet and, what's worse, I still like those :-).
> Also, some of the major proponents want parameterized decorators and
> multiple decorators, not just a different position for staticmethod
> and classmethod. So
I can't see a problem here. If I understand correctly, decorators are
meant to be some sort of callables, so if you need parameters you can
very easily use functors (just bear with my C++ heritage once again
;-) or however those classes with a __call__ method are called in
python. That's exactly what I use functors regularly for.
> For what its worth: 1) this issue and multiple alternatives has been
> discussed since at least Jan 03. Since then, it has possibly taken
> more devel time, and probably more Pydev postings than any single
> other issue; 2) the PEP is broken and Guido knows it. We'll see if
Then I can very well understand that almost everyone seems quite
emotional about this thing. Sorry for beating a dead horse here, but
I just wanted to insert my € 0,02.
More information about the Python-list