[melbourne-pug] foo is None bar is 2 so is foo < bar

Ben Finney ben+python at benfinney.id.au
Fri Feb 7 08:32:58 CET 2014


Mike Dewhirst <miked at dewhirst.com.au> writes:

> But it seems not in Python 3.3 ...
>
> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600
> 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> foo = None
> >>> bar = 2
> >>> foo < bar
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unorderable types: NoneType() < int()
> >>>
>
> Should I rtfm?

The answer to that question is always “yes” :-) It's good to understand
what is done (read the manual) and why it's done (read the “What's New”
documents).

> Maybe there is a trick to it?

A trick to what? What are you expecting to happen, and how does this
behaviour violate your expectation?

-- 
 \     “We are not gonna be great; we are not gonna be amazing; we are |
  `\           gonna be *amazingly* amazing!” —Zaphod Beeblebrox, _The |
_o__)                Hitch-Hiker's Guide To The Galaxy_, Douglas Adams |
Ben Finney



More information about the melbourne-pug mailing list