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

Can't use decorators without "@" syntax #85

Closed
martinvol opened this issue Oct 28, 2019 · 2 comments
Closed

Can't use decorators without "@" syntax #85

martinvol opened this issue Oct 28, 2019 · 2 comments

Comments

@martinvol
Copy link

>>> backoff.on_exception(print, backoff.expo, Exception, max_tries=8)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: on_exception() got multiple values for argument 'max_tries'
@bgreen-litl
Copy link
Member

I'm not sure if you mean this as a feature request, but the above fails because you are passing on_exception an extra argument. Take print out and the above will work.

You can actually use them without the decorator syntax if you want:

>>> retry = backoff.on_exception(backoff.expo, Exception, max_tries=8)
>>> retry(print)
<function print>
>>> retry(print)("foo")
foo

@martinvol
Copy link
Author

Sorry I messed up with the syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants