Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Tue, 14 Oct 2008

Chaining operators in Python

One of the little things I love about Python is that you can chain comparison operators like this:

10 <= x <= 20

or

x == y == z

Strangely, I hadn't realized until yesterday that this also works with the is operator:

x is y is z
posted at 03:17 | tags: | permanent link to this entry | 0 comments

Name (required)


E-mail (will not be shown)


URL


Comment (some HTML allowed)