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.
AB#3603272
Tech Debt
We have
valueas a data member andvalueas a formal argument. Very different use, but identical names.I will illustrate the problem with one of the functions:
Several places where we have the
value.valueconstruct 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
otheris treated as positional argument only.AB#3603272