
March 18, 2010
7:49 a.m.
Decorators are great, they make this: def some_func(*args, **kwargs): return "sup" some_func = decorator(some_func) into this: @decorator def some_func(*args, **kwargs): return "sup" which makes the code look more structured. The line at the bottom looks more like it 'belongs' to the function when it's at the top of the def block, as opposed to the bottom. But when it comes to function properties, it'd be nice if that same pattern was availiable: def some_func(*args, **kwargs): return "sup" some_func.printable = True becomes: @printable=True def some_func(*args, **kwargs): return "sup" Any thoughts?