-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Fix is_simple_callable with variable args, kwargs #4622
Conversation
5891042
to
fa39098
Compare
Thanks for working towards this! Milestoned this as 3.5.2 to keep it on our immediate horizon. Some tests failing in its current state. |
yep - see my comment on #4602. I'll have to think more on how to proceed with the fix. |
6242761
to
e41586e
Compare
e41586e
to
8952096
Compare
This should be good to go now. There were two separate issues:
|
Great work! 😄 👍 ✨ |
param.kind == param.VAR_KEYWORD or | ||
param.default != param.empty | ||
for param in params | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rpkilby: Can you just explain this call to me, just for my sanity? 🙂
I'm expecting any(iterable) — it looks like bool or bool or generator, so why isn't it this:
>>> a = True
>>> b = True
>>> def c():
... yield True
... yield False
>>> all(a or b or c())
TypeError: 'bool' object is not iterable
Sorry for being slow. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. 1 second after Comment it becomes clear. ... — even seeing it though, I still struggle to read it right...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@carltongibson - it probably wouldn't have hurt to have added a second set of parens wrapping the conditions
return all((
param.kind == param.VAR_POSITIONAL or
param.kind == param.VAR_KEYWORD or
param.default != param.empty
) for param in params
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's kind to of where I came to. (That vs a nested any
)
It's fine.
Fix #4602
py3k
is_simple_callable
was not accounting for variable args and kwargs