[issue20630] Add sorting helpers for collections containing None values
Raymond Hettinger
report at bugs.python.org
Mon Feb 24 22:38:58 CET 2014
Raymond Hettinger added the comment:
> If it is in fact specific to sorting, then this specific symptom
> and "the problem" are in fact the same thing ;-)
The first rule of tautology club is the first rule of tautology club ;-)
FWIW, we had to add a work-around for this in pprint._safe_key class. Without that work-around, it was difficult to work with JSON-style data hierarchies:
# wouldn't pprint() without the _safe_key() work-around:
temperatures = {'Jan': 25.2, 'Feb': 22.3, 'Mar': None, 'Apr': 19.1,
'May': 22.2, 'Jun': None, 'July': 22.3}
I think this will be typical for the kind of issue people will encounter when using None as a placeholder for missing data.
FWIW, if None stays non-comparable, Nick's additions look fine to me. I just think it easier for everyone to restore None's universal comparability rather than adding work-arounds for the problems caused by removing that capability.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20630>
_______________________________________
More information about the Python-bugs-list
mailing list