Is there any clever in-built function or something that will return 1
for the min()
example below? (I bet there is a solid reason for it not to return anything, but in my particular case I need it to disregard None
values really bad!)
>>> max([None, 1,2])
2
>>> min([None, 1,2])
>>>
None
is only returned in Python 2. In Python 3,min([None, 1, 2])
yields aTypeError: '<' not supported between instances of 'int' and 'NoneType'
. – Braeunig