From dec4f4b76ae9b2b953bcc093275aa59f93adf6fd Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Fri, 26 Apr 2013 21:31:12 -0600 Subject: 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. --- numpy/oldnumeric/alter_code2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/oldnumeric/alter_code2.py') diff --git a/numpy/oldnumeric/alter_code2.py b/numpy/oldnumeric/alter_code2.py index 4e4d94cd6..c163c9565 100644 --- a/numpy/oldnumeric/alter_code2.py +++ b/numpy/oldnumeric/alter_code2.py @@ -54,7 +54,7 @@ def changeimports(fstr, name, newname): ind = 0 Nlen = len(fromstr) Nlen2 = len("from %s import " % newname) - while 1: + while True: found = fstr.find(fromstr,ind) if (found < 0): break -- cgit v1.2.1