[issue7396] regrtest single: iterator not subscriptable

James G. sack (jim) report at bugs.python.org
Thu Nov 26 05:50:15 CET 2009


New submission from James G. sack (jim) <jgsack at users.sourceforge.net>:

file Lib/tests/regrtest.py
 
Evidently rev 76260 (trunk) / 76261 (py3k)
broke code at
  rev 76324 line 655 (py3k)
  rev 76321 line 620 (trunk) 
which is
   if tests[0] == alltests[i]  
because tests was rebound from a list to an iterable, and hence indexing 
cannot be performed on tests subsequent to the rebinding.

There are a few other places where tests is indexed, but I suspect those 
places are before the rebinding to an iterable.

At first glance, a viable patch might be to use a different name, eg 
itests, and leave the original tests list available for use by the line 
causing the TypeError. However, I think someone more knowledgeable needs 
to have a look.

Ummm, forgive me if this is offbase, but would it be fair to identify as 
a bad practice, the rebinding of a variable to a different type. 

~jim

----------
messages: 95731
nosy: jgsack
severity: normal
status: open
title: regrtest single: iterator not subscriptable
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7396>
_______________________________________


More information about the Python-bugs-list mailing list