[Python-Dev] 2.4a2, and @decorators (original) (raw)
Mark Russell marktrussell at btopenworld.com
Tue Aug 3 13:06:54 CEST 2004
- Previous message: [Python-Dev] 2.4a2, and @decorators
- Next message: [Python-Dev] 2.4a2, and @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 2004-08-03 at 05:17, James Y Knight wrote:
Things someone might want to do, ordered roughly from most reasonable to least reasonable ;) @foo().bar() @foo or bar @mydecorators['foo'] @lambda f: foo(f) or bar(f)
Why disallow these forms? It seems quite difficult, especially, to explain why the first one does not, or should not, work.
I don't think any of these seem that likely in practice, and if you do want them, it is not hard to say:
# Hopefully some comment here explaining the reason why you're
# doing this. And a more meaningful name than foo_or_bar!
foo_or_bar = foo or bar
@foo_or_bar
def func(): pass
I would say leave it like this for now. It is easy to relax the restriction later if there's a demand.
Mark
- Previous message: [Python-Dev] 2.4a2, and @decorators
- Next message: [Python-Dev] 2.4a2, and @decorators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]