Join GitHub today
Don't check for 'linux2' value in sys.platform #549
The linux kernel is transitioning to version 3.0, and this means that the sys.platform string will become on such machines 'linux3' instead. Right now, we have explicit checks for linux2:
(master)amirbar[IPython]> grin linux2 ./quarantine/InterpreterExec.py: 139 : sys.platform is: linux2 ./testing/decorators.py: 300 : skip_linux = skipif(sys.platform == 'linux2', 308 : skip_if_not_linux = skipif(sys.platform != 'linux2', ./testing/tests/test_decorators.py: 179 : nt.assert_not_equals(sys.platform,'linux2',"This test can't run under linux") ./utils/sysinfo.py: 129 : 'sys_platform': 'linux2',
All these should become variants of 'foo[:5] == 'linux'.
I'll tag this as 0.11 in case we can make it, as it's an easy fix and it would be nice to run out of the box for people who upgrade kernels early. But it's not super critical.
I suggested the uglier one b/c it's a little faster, I had checked both:
In : timeit sys.platform.startswith('linux') 1000000 loops, best of 3: 294 ns per loop In : timeit sys.platform[:5] == 'linux' 1000000 loops, best of 3: 210 ns per loop
I know that 85ns may be a silly thing to worry about, but I tend to be a bit anal about avoiding slowdowns everywhere. Do you see another reason for sticking with the startswith form?