We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Context: Lines 141 - 156 in phantompy / phantompy / context.py on branch master, as of 444219e
Is there a reason why _type is compared to primitives using == rather than isinstance or is?
==
isinstance
is
From PEP8 (http://www.python.org/dev/peps/pep-0008/#programming-recommendations), "Object type comparisons should always use isinstance() instead of comparing types directly."
def __new__(cls): def _make_getter(key, _type): def getter(self): if _type == bool: return _type(lib.ph_context_get_boolean_config(key)) elif _type == int: return _type(lib.ph_context_get_int_config(key)) return getter def _make_setter(key, _type): def setter(self, value): if _type == int: lib.ph_context_set_int_config(key, int(value)) elif _type == bool: lib.ph_context_set_boolean_config(key, int(value))
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Context: Lines 141 - 156 in phantompy / phantompy / context.py on branch master, as of 444219e
Is there a reason why _type is compared to primitives using
==
rather thanisinstance
oris
?From PEP8 (http://www.python.org/dev/peps/pep-0008/#programming-recommendations), "Object type comparisons should always use isinstance() instead of comparing types directly."
The text was updated successfully, but these errors were encountered: