summaryrefslogtreecommitdiff
path: root/numpy/f2py/cfuncs.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2013-04-26 21:31:12 -0600
committerCharles Harris <charlesr.harris@gmail.com>2013-05-02 21:13:17 -0600
commitdec4f4b76ae9b2b953bcc093275aa59f93adf6fd (patch)
tree13a9a50d087f6c55a6afb942437afc99110cd6f5 /numpy/f2py/cfuncs.py
parent63a9f197d040b5479b772fd3925274fc984ffd24 (diff)
downloadnumpy-dec4f4b76ae9b2b953bcc093275aa59f93adf6fd.tar.gz
MAINT: Apply 2to3 idioms fixer.
The idioms fixer makes the following replacements. 1) int <- bool 2) comparison or identity of types <- isinstance 3) a.sort() <- sorted(a) There were two problems that needed to be dealt with after the application of the fixer. First, the replacement of comparison or identity of types by isinstance was not always correct. The isinstance function returns true for subtypes whereas many of the places where the fixer made a substitution needed to check for exact type equality. Second, the sorted function was applied to arrays, but because it treats them as iterators and constructs a sorted list from the result, that is the wrong thing to do. Closes #3062.
Diffstat (limited to 'numpy/f2py/cfuncs.py')
-rw-r--r--numpy/f2py/cfuncs.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py
index a16a07d59..2229c3e24 100644
--- a/numpy/f2py/cfuncs.py
+++ b/numpy/f2py/cfuncs.py
@@ -1128,10 +1128,10 @@ def buildcfuncs():
def append_needs(need,flag=1):
global outneeds,needs
- if type(need)==list:
+ if isinstance(need, list):
for n in need:
append_needs(n,flag)
- elif type(need)==str:
+ elif isinstance(need, str):
if not need: return
if need in includes0:
n = 'includes0'
@@ -1160,7 +1160,7 @@ def append_needs(need,flag=1):
if need in needs:
for nn in needs[need]:
t=append_needs(nn,0)
- if type(t)==dict:
+ if isinstance(t, dict):
for nnn in t.keys():
if nnn in tmp:
tmp[nnn]=tmp[nnn]+t[nnn]
@@ -1176,7 +1176,7 @@ def append_needs(need,flag=1):
if need in needs:
for nn in needs[need]:
t=append_needs(nn,flag)
- if type(t)==dict:
+ if isinstance(t, dict):
for nnn in t.keys():
if nnn in tmp:
tmp[nnn]=t[nnn]+tmp[nnn]