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

framework.py enhancement #8471

Merged

Conversation

tonyyang-svail
Copy link

No description provided.

@@ -418,29 +418,28 @@ def find_name(var_list, name):
return True
return False

if inputs is not None:
Copy link
Contributor

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.

@tonyyang-svail tonyyang-svail changed the title [WIP] framework.py enhancement framework.py enhancement Feb 22, 2018
helinwang
helinwang previously approved these changes Feb 22, 2018
Copy link
Contributor

@helinwang helinwang left a 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):
Copy link
Contributor

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...

Copy link
Author

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:

Copy link
Contributor

@helinwang helinwang Feb 22, 2018

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.

helinwang
helinwang previously approved these changes Feb 23, 2018
Copy link
Contributor

@helinwang helinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@helinwang helinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tonyyang-svail tonyyang-svail merged commit d4dabe3 into PaddlePaddle:develop Feb 23, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants