[Checkins] SVN: zope.interface/branches/regebro-python3/src/zope/interface/ In Python 3 iter().next() is renamed to iter().__next__, which doesn't exist in 2.4 and 2.5. The only solution is to use list comprehensions instead. 120 tests running 32 to go...

Lennart Regebro regebro at gmail.com
Wed Apr 8 04:02:00 EDT 2009


Log message for revision 99001:
  In Python 3 iter().next() is renamed to iter().__next__, which doesn't exist in 2.4 and 2.5. The only solution is to use list comprehensions instead. 120 tests running 32 to go...

Changed:
  U   zope.interface/branches/regebro-python3/src/zope/interface/declarations.py
  U   zope.interface/branches/regebro-python3/src/zope/interface/interface.py

-=-
Modified: zope.interface/branches/regebro-python3/src/zope/interface/declarations.py
===================================================================
--- zope.interface/branches/regebro-python3/src/zope/interface/declarations.py	2009-04-08 07:10:36 UTC (rev 99000)
+++ zope.interface/branches/regebro-python3/src/zope/interface/declarations.py	2009-04-08 08:01:59 UTC (rev 99001)
@@ -96,12 +96,8 @@
           >>> spec = Declaration(I2, I3)
           >>> spec = Declaration(I4, spec)
           >>> i = iter(spec)
-          >>> i.next().getName()
-          'I4'
-          >>> i.next().getName()
-          'I2'
-          >>> i.next().getName()
-          'I3'
+          >>> [x.getName() for x in i]
+          ['I4', 'I2', 'I3']
           >>> list(i)
           []
         """
@@ -124,16 +120,8 @@
           >>> spec = Declaration(I2, I3)
           >>> spec = Declaration(I4, spec)
           >>> i = spec.flattened()
-          >>> i.next().getName()
-          'I4'
-          >>> i.next().getName()
-          'I2'
-          >>> i.next().getName()
-          'I1'
-          >>> i.next().getName()
-          'I3'
-          >>> i.next().getName()
-          'Interface'
+          >>> [x.getName() for x in i]
+          ['I4', 'I2', 'I1', 'I3', 'Interface']
           >>> list(i)
           []
 

Modified: zope.interface/branches/regebro-python3/src/zope/interface/interface.py
===================================================================
--- zope.interface/branches/regebro-python3/src/zope/interface/interface.py	2009-04-08 07:10:36 UTC (rev 99000)
+++ zope.interface/branches/regebro-python3/src/zope/interface/interface.py	2009-04-08 08:01:59 UTC (rev 99001)
@@ -336,12 +336,8 @@
           >>> spec = Specification((I2, I3))
           >>> spec = Specification((I4, spec))
           >>> i = spec.interfaces()
-          >>> i.next().getName()
-          'I4'
-          >>> i.next().getName()
-          'I2'
-          >>> i.next().getName()
-          'I3'
+          >>> [x.getName() for x in i]
+          ['I4', 'I2', 'I3']
           >>> list(i)
           []
         """
@@ -504,8 +500,8 @@
           ...
           >>>
           >>> i = I1.interfaces()
-          >>> i.next().getName()
-          'I1'
+          >>> [x.getName() for x in i]
+          ['I1']
           >>> list(i)
           []
         """



More information about the Checkins mailing list