0 purchases
returnresult 1.1.0
return-result
This defines a decorator that causes the variable result to be automatically returned from a function when there is no return statement.
This works by getting the source code of the decorated function, so this won't work in the CPython REPL. It does work in IPython however.
Inspired by the Nim feature that does the same thing.
Example
>>> from return_result import return_result
>>> @return_result
... def test():
... result = "Works!"
>>> test()
'Works!'
Requirements
Python 3.6+
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.