[Python-ideas] @return?
Lie Ryan
lie.1296 at gmail.com
Fri Apr 16 19:16:19 CEST 2010
On 04/14/10 07:36, Conrad Irwin wrote:
> The proposal is thus to introduce "@return" that returns the decorated
> object, a hybrid of the behavior of the return statement and decorators.
> I think the intended semantics are clear, providing you know the basics
> of how decorators work:
>
> def decorator(func):
> @return
> def wrapper(*args):
> func(modulate(args))
Why stop half-way? Why not eliminate the nested defs as well:
@decorator(func)
def wrapper(*args):
func(modulate(args))
to mean:
def decorator(func):
def wrapper(*args):
func(modulate(args))
return wrapper
More information about the Python-ideas
mailing list