[Python-Dev] PEP 318 trial balloon (wrappers) (original) (raw)

Raymond Hettinger python at rcn.com
Thu Mar 11 16:57:09 EST 2004


[Jewett, Jim J]

class Foo: def bar(): pass bar = transform(bar) ... I would like to do the same with decorators.

class Foo: [transform] from: def bar(): pass The bar() function is now defined exactly as it was before, except that it is an extra indent to the right.

-1 This gains nothing over what we have now but does incur costs on readability, yet another syntax, and limiting the ability to apply a decoration outside the class definition.

In its favor, this syntax does suggest something new which is the possibility of having all similar decorations grouped under one banner:

class Foo: [transform] from" def bar(): pass def bat(): pass def baf(): pass

That being said, grouping doesn't go much for me. I think the key to the previous proposals was putting wrappers on the same line as the function definition.

Raymond Hettinger

################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# #################################################################



More information about the Python-Dev mailing list