Sorting list by an attribute that can be None
The ordering comparison operators are stricter about types in Python 3, as described here: The ordering comparison operators (<, <=, >=, >) raise a TypeError exception when the operands don’t have a meaningful natural ordering. Python 2 sorts None before any string (even empty string): >>> None < None False >>> None < “abc” True … Read more