Minor improvements to itertools.tee():
* tee object is no longer subclassable
* independent iterators renamed to "itertools.tee_iterator"
* fixed doc string typo and added entry in the module doc string
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index ce03b1a..e12aa41 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -243,6 +243,18 @@
self.assertRaises(TypeError, tee, 3)
self.assertRaises(TypeError, tee, [1,2], 'x')
+ try:
+ class A(tee): pass
+ except TypeError:
+ pass
+ else:
+ self.fail("tee constructor should not be subclassable")
+
+ # tee_iterator should not be instantiable
+ a, b = tee(xrange(10))
+ self.assertRaises(TypeError, type(a))
+ self.assert_(a is iter(a)) # tee_iterator should support __iter__
+
def test_StopIteration(self):
self.assertRaises(StopIteration, izip().next)