[issue22979] Use of None in min and max

Simeon Visser report at bugs.python.org
Tue Dec 2 16:23:32 CET 2014


Simeon Visser added the comment:

This doesn't happen in Python 3 as None can't be compared to other elements:

>>> min([1,2,3,None])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() < int()

I can also imagine people now using min with the intended behaviour of "give me the smallest element, or None if it happens to be present".

----------
nosy: +simeon.visser

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22979>
_______________________________________


More information about the Python-bugs-list mailing list