zeldor.biz

Linux, programming and more

Copyright © 2023
Log in

Python Comparison Operators

August 28, 2010 by Igor Drobot Leave a Comment

All following comparison operators have the standard mathematical interpretation and return a boolean value of True for true, False for false:

Comparison operations are supported by all objects!

This table summarizes the comparison operations:

Operation Meaning
< strictly less than
<= less than or equal
> strictly greater than
>= greater than or equal
== equal
!= not equal*
is object identity
is not negated object identity

* != can also be written <>, but this is an obsolete usage kept for backwards compatibility only. New code should always use !=.

Filed Under: Linux Tagged With: Programming, Python