-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() #12139
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
Have UserDict.__init__() implicitly check for updating w/ bool(kwargs) instead of len() #12139
Conversation
eamanu
left a comment
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.
look good. But why do you use this check and not use the len?
Are there some bpo for this?
|
I don't think there's BPO for this, just found this while researching ABC-related things. Reason for this change – I think checks vs |
|
I don't think the test is needed anyway, if |
|
@remilapeyre that was my original intention, but |
|
Thanks for clarifying! |
remilapeyre
left a comment
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.
The change is obviously correct and I don't think it needs a b.p.o submission nor a NEWS entry.
I'm not sure it's needed either but a core developer will either merge or close the PR during the next review.
|
Thanks! |
Semantically the same, but more idiomatic by checking against
kwargsinstead oflen(kwargs).