I'm still using 2.4 in one of my projects and have come across this a few times. The most elegant solution I've see for this is:
x = {True: 1, False: 2}[foo is not None]
I like this because it represents a more clear boolean test than using a list with the index values 0 and 1 to get your return value.