Created
March 21, 2014 00:40
-
-
Save Tinche/9677148 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> cat test.py | |
from contextlib import contextmanager | |
@contextmanager | |
def polite(): | |
print("Hi!") | |
yield | |
print("Bye!") | |
@polite | |
def fun(): | |
pass | |
> python3 test.py | |
Traceback (most recent call last): | |
File "test.py", line 9, in <module> | |
@polite | |
File "/usr/lib/python3.3/contextlib.py", line 115, in helper | |
return _GeneratorContextManager(func, *args, **kwds) | |
File "/usr/lib/python3.3/contextlib.py", line 37, in __init__ | |
self.gen = func(*args, **kwds) | |
TypeError: polite() takes 0 positional arguments but 1 was given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment