Chris Lamb: No-one expects the string literal exception

August 24, 2009

This cracked me up once I figured it out. Seen on Planet Debian: a cute exploration of Python arcana.

You’ll actually need Python ≤ 2.5 to reproduce that behaviour, but what’s actually neat about all this is that the exception will be caught—without warnings—as you originally expected under Python 2.6, dispite string literals being “truly and utterly dead”. See if you can work out why.

Comments Off