diff options
author | Seth M Morton <seth.m.morton@gmail.com> | 2015-06-03 20:43:28 -0700 |
---|---|---|
committer | Seth M Morton <seth.m.morton@gmail.com> | 2015-06-03 22:52:43 -0700 |
commit | 8eaa4300d1db103e1b91e334a2a8d5c0284859ca (patch) | |
tree | de5828abd74147895c082b67850c720eabcd7c05 /natsort/ns_enum.py | |
parent | d77fe4ee4b55d48803fa05a9d1735e6df5fb2b34 (diff) | |
download | natsort-8eaa4300d1db103e1b91e334a2a8d5c0284859ca.tar.gz |
Added NaN handling.
If an NaN is detected, the NaN will be converted to a -inf or +inf.
NaN will mess up sorting, so this will give some order to the sorting.
Diffstat (limited to 'natsort/ns_enum.py')
-rw-r--r-- | natsort/ns_enum.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/natsort/ns_enum.py b/natsort/ns_enum.py index 8b9d794..ebe3374 100644 --- a/natsort/ns_enum.py +++ b/natsort/ns_enum.py @@ -102,6 +102,10 @@ class ns(object): behavior without `LOCALE`. UNGROUPLETTERS, UG An alias for `CAPITALFIRST`. + NANLAST, NL + If an NaN shows up in the input, this instructs `natsort` to + treat these as +Infinity and place them after all the other numbers. + By default, an NaN be treated as -Infinity and be placed first. TYPESAFE, T Try hard to avoid "unorderable types" error on Python 3. It is the same as setting the old `py3_safe` option to `True`. @@ -150,7 +154,8 @@ _ns = { 'GROUPLETTERS': 128, 'G': 128, 'UNGROUPLETTERS': 256, 'UG': 256, 'CAPITALFIRST': 256, 'C': 256, - 'TYPESAFE': 1024, 'T': 1024, + 'NANLAST': 512, 'NL': 512, + 'TYPESAFE': 2048, 'T': 2048, } # Populate the ns class with the _ns values. for x, y in _ns.items(): |