Is there a Python built-in datatype, besides None, for which:
>>> not foo > None
True
where foo is a value of that type? How about Python 3?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Noneis always less than any datatype in Python 2 (seeobject.c).In Python 3, this was changed; now doing comparisons on things without a sensible natural ordering results in a
TypeError. From the 3.0 “what’s new” updates:This upset some people since it was often handy to do things like sort a list that had some
Nonevalues in it, and have theNonevalues appear clustered together at the beginning or end. There was a thread on the mailing list about this a while back, but the ultimate point is that Python 3 tries to avoid making arbitrary decisions about ordering (which is what happened a lot in Python 2).