Most creative/diabolical/entertaining way to find Python version?

3

There are important differences between Python 2 and 3, so it's often useful to know which version of the interpreter is running your code. The straightforward method is something like this:

def get_python_version():
    import sys
    return sys.version_info.major

But you can exploit other differences to come up with other solutions to this. My favorite so far is this:

def get_python_version():
    version = 3;[2 for version in range(3)]
    return version

What's the most creative/diabolical/entertaining snippet you can come up with that returns the Python version?

jakevdp

Posted 2015-11-18T21:14:11.780

Reputation: 757

Question was closed 2015-11-18T21:28:09.057

1http://codegolf.stackexchange.com/a/55963/42963 – AdmBorkBork – 2015-11-18T21:15:44.977

1

Related: link1, link2

– Sp3000 – 2015-11-18T23:54:18.113

No answers