14 May
2008
14 May
'08
12:24 a.m.
Steven D'Aprano wrote:
With iterators being such a fundamental part of Python these days, perhaps one day we'll see the functions in the itertools module become iterator methods
I hope not. The set of potential functions that operate on iterators is open-ended, and there's no reason to single out a particular subset and make them methods. Also, it would force all iterators to inherit from a common base class in order to support those methods, which is not a Pythonic thing to do. Strings are different, because (a) they're a concrete class, and (b) string methods benefit from having access to implementation details of the string. -- Greg