generated from ni/github-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
tech debtNon-user-visible improvement to code or development processNon-user-visible improvement to code or development process
Description
Tech Debt
We have value as a data member and value as a formal argument. Very different use, but identical names.
I will illustrate the problem with one of the functions:
def __gt__(self, value: Scalar[TScalar_co]) -> bool:
"""Return self > value."""
if not isinstance(value, self.__class__):
return NotImplemented
self._check_units_equal_for_comparison(value.units)
if isinstance(self.value, _NUMERIC) and isinstance(value.value, _NUMERIC):
return self.value > value.value # type: ignore[no-any-return,operator] # https://github.c
elif isinstance(self.value, str) and isinstance(value.value, str):
return self.value > value.value
else:
raise TypeError("Comparing Scalar objects of numeric and string types is not permitted")
Several places where we have the value.value construct are particularly confusing.
I suggest changing the name of the formal argument to "other", and adding a slash the way we have it in eq to make sure that other is treated as positional argument only.
Metadata
Metadata
Assignees
Labels
tech debtNon-user-visible improvement to code or development processNon-user-visible improvement to code or development process