Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 318 Examples 4 the order of @accepts and @returns maybe wrong #910

Open
chenyangdream opened this issue Mar 4, 2019 · 0 comments
Open

PEP 318 Examples 4 the order of @accepts and @returns maybe wrong #910

chenyangdream opened this issue Mar 4, 2019 · 0 comments

Comments

@chenyangdream
Copy link

@chenyangdream chenyangdream commented Mar 4, 2019

Example 4
@accepts(int, (int,float))
@returns((int,float))
def func(arg1, arg2):
return arg1 * arg2

The order of @accepts and @returns should be reversed, otherwise, the assertion will be raised.

Traceback (most recent call last):
  File "/Users/jack/PycharmProjects/tutorial/testdecorator.py", line 25, in <module>
    @returns((int,float))
  File "/Users/jack/PycharmProjects/tutorial/testdecorator.py", line 3, in check_accepts
    assert len(types) == f.func_code.co_argcount
AssertionError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant