if sys.py3k: # some py2k specific code pass Why? 1. readable 2. traceable Explained: 1. self-explanatory 2. sys.version_info >= (3, 0) or sys.version[0] == '3' is harder to trace when you need to find all python 3 related hacks -- anatoly t.