[Python-Dev] Decorator syntax J2 (decorate..def), with implementation (original) (raw)
Nick Coghlan ncoghlan at iinet.net.au
Mon Aug 16 01:58:55 CEST 2004
- Previous message: [Python-Dev] Decorator syntax J2 (decorate..def), with implementation
- Next message: [Python-Dev] Decorator syntax J2 (decorate..def), with implementation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Barry Warsaw wrote:
On Fri, 2004-08-13 at 19:24, Bob Ippolito wrote:
My only problem with this syntax is that I expect the common cases (mine, anyway) to be zero or one decorators per function, so the extra block and indent seems a bit excessive compared to the current @prefix-symbol-decorator proposal(s). It is, of course, far better than typing the function name three times though! :) Same here. It trades one line at the end of the function for two (or more) before the beginning of the function. -0
What about the variant which makes the block optional when there is only one decorator?
i.e. decorate: staticmethod def foobar(): pass
The other thing I like about this version is that a folding editor like PythonWin can easily compress a decorated definition down to two lines, while leaving it clear that the function is decorated. That's not a huge point, though.
Cheers, Nick.
-- Nick Coghlan | Eugene, Oregon Email: ncoghlan at email.com | USA
- Previous message: [Python-Dev] Decorator syntax J2 (decorate..def), with implementation
- Next message: [Python-Dev] Decorator syntax J2 (decorate..def), with implementation
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]