Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7163433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:54:09+00:00 2026-05-28T13:54:09+00:00

Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32

  • 0
Python 2.7.2 (default, Jun 12 2011, 14:24:46) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> None > 0
False
>>> None == 0
False
>>> None < 0
True
  • Is comparing None using arithmetic operators well defined for built-in types (integers in this case)?
  • Is the difference between the first two and the third comparison part of language specification (Python’s specification – you must be kidding :)) or is it CPython’s implementation detail?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:54:10+00:00Added an answer on May 28, 2026 at 1:54 pm

    The only meaningful comparison you can really use with None is if obj is None: (or if obj is not None:).

    Comparison between different types has been removed from Python 3 for good reasons – they were a common source of errors and lead to confusion. For example

    >>> "3" < 4
    False
    

    In Python 3, you get a TypeError when comparing values of different types like str vs. int or anything vs. None.

    >>> None < 0
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: unorderable types: NoneType() < int()
    

    (I mean “comparing” in the sense of trying to determine which of two values is larger/smaller. Comparison for equality is OK – it will always return False if two object are of different types.)

    I haven’t found a reference in the docs for this, but in Learning Python, 4th edition, Mark Lutz writes on page 204:

    […] Comparisons of differently typed objects (e.g., a string and a
    list) work — the language defines a fixed ordering among different
    types, which is deterministic, if not aesthetically pleasing. That is,
    the ordering is based on the names of the types involved: all integers
    are less than all strings, for example, because "int" is less than
    "str".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Python 2.6 more than I use Leopard's default python installation, so I
Do the following on the default Python install on Mac OS X 10.5 (Leopard)
I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04
Is output buffering enabled by default in Python's interpreter for sys.stdout ? If the
Python's subprocess module by default passes all open file descriptors to any child processes
Python for Windows by default comes with IDLE, which is the barest-bones IDE I've
I know python functions are virtual by default. Let's say I have this: class
It seems that Python 2.6.1 doesn't compile bz2 library by default from source. I
If you install multiple versions of python (I currently have the default 2.5, installed
How can I revert back to the default function that python uses if there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.