scikit-hep / awkward-0.x

Manipulate arrays of complex data structures as easily as Numpy.
BSD 3-Clause "New" or "Revised" License
215 stars 39 forks source link

Syntax warning due to comparison of literals using is in Python 3.8 #245

Closed tirkarthi closed 4 years ago

tirkarthi commented 4 years ago
find . -iname '*.py' | grep -Ev 'test.py' | xargs -P4 -I{} python3.8 -Wall -m py_compile {}
./awkward/array/chunked.py:217: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if tpe is not None and tpe is not ():
./awkward/array/chunked.py:222: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if tpe is not None and tpe is not ():
./awkward/array/chunked.py:228: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if self._types[i] is None or self._types[i] is () or self._types[i] is tpe:
jpivarski commented 4 years ago

Thanks! That's a good check. Tuples being immutable, there can never be "different" empty tuples, but that doesn't mean that Python implements them as a singleton, they way it does None. That was a potentially bad assumption.