While this looks funny and smart, it's not really a good solution as it lacks well communicated documentation. Python has a proper way to check for version, which is backward-compatible till version 2.0, so around 20+ years.
import sys
if sys.version_info.major < 3:
raise Exception('Need Python 3 or higher')
EDIT: correction, sys.version_info.major is only there since Python 2.7. For older versions sys.version_info[0] should be used.