[Python-checkins] r61213 - python/trunk/Lib/_abcoll.py

raymond.hettinger python-checkins at python.org
Mon Mar 3 23:04:55 CET 2008


Author: raymond.hettinger
Date: Mon Mar  3 23:04:55 2008
New Revision: 61213

Modified:
   python/trunk/Lib/_abcoll.py
Log:
Remove dependency on itertools -- a simple genexp suffices.

Modified: python/trunk/Lib/_abcoll.py
==============================================================================
--- python/trunk/Lib/_abcoll.py	(original)
+++ python/trunk/Lib/_abcoll.py	Mon Mar  3 23:04:55 2008
@@ -9,7 +9,6 @@
 """
 
 from abc import ABCMeta, abstractmethod
-import itertools
 
 __all__ = ["Hashable", "Iterable", "Iterator",
            "Sized", "Container", "Callable",
@@ -189,7 +188,8 @@
     def __or__(self, other):
         if not isinstance(other, Iterable):
             return NotImplemented
-        return self._from_iterable(itertools.chain(self, other))
+        chain = (e for s in (self, other) for e in s)
+        return self._from_iterable(chain)
 
     def __sub__(self, other):
         if not isinstance(other, Set):


More information about the Python-checkins mailing list