clock is re-defining a name which is already available in the outer-scope (previously defined on line 9).
It is generally a bad practice to shadow variables from the outer-scope. In most
cases, this is done unintentionally and might lead to unexpected behavior:
param=5classFoo:def__init__(self,param):# "param" would be flagged hereself.param=param
Loading history...
15
except ImportError: # 3.2
16
from time import clock
17
finally:
18
5
wclock = clock()
19
5
return wclock
20
21
22
5
def enum_cpus():
23
"""
24
Backwards compatibility wrapper for CPU count.
25
"""
26
5
try:
27
5
from os import cpu_count
28
1
except ImportError: # 3.2, 3.3
29
1
from multiprocessing import cpu_count
30
finally:
31
5
cpus = cpu_count()
32
5
return cpus
33
34
35
5
def where_which(path):
36
"""
37
Backwards compatibility wrapper for approximating which/where.
It is generally a bad practice to shadow variables from the outer-scope. In most cases, this is done unintentionally and might lead to unexpected behavior: