-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
framework.py enhancement #8471
framework.py enhancement #8471
Conversation
python/paddle/v2/fluid/framework.py
Outdated
@@ -418,29 +418,28 @@ def find_name(var_list, name): | |||
return True | |||
return False | |||
|
|||
if inputs is not None: |
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.
Is this assuming inputs is not possible to be None? If so maybe we need to remove the default None value from the argument list.
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.
LGTM!
@@ -474,7 +473,7 @@ def find_name(var_list, name): | |||
raise TypeError("'attrs' should be a dict.") | |||
for attr in proto.attrs: | |||
attr_name = attr.name | |||
if (not attr_name in attrs) or (attrs[attr_name] is None): | |||
if (attr_name not in attrs) or (attrs[attr_name] is None): |
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.
Hard to believe Python can do the same thing with so many different ways...
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.
From PEP8
Use is not operator rather than not ... is. While both expressions are
functionally identical, the former is more readable and preferred.
Yes:
if foo is not None:
No:
if not foo is None:
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.
Thanks for the info. It's better if only one is allowed by the syntax.
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.
LGTM.
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.
LGTM!
No description provided.