[Zope-Checkins] CVS: Products/DCOracle2/DCOracle2 - DCOracle2.py:1.97

Fred L. Drake, Jr. fred@zope.com
Fri, 25 Oct 2002 10:40:17 -0400


Matthew T. Kromer writes:
 > +# For the next() idiom which is Python 2.2, there is no StopIteration in
 > +# earlier pythons
 > +if split(sys.version)[0]  < '2.2.0':
 > +    StopIteration = IndexError

A better way to do this would be to use a feature test instead of a
version test.  There's also no need to associate StopIteration with
IndexError, so they can be kept separate:

try:
    StopIteration
except NameError:
    class StopIteration(Exception):
        pass


  -Fred

-- 
Fred L. Drake, Jr.  <fred at zope.com>
PythonLabs at Zope Corporation