¡@

Home 

python Programming Glossary: self._iterator

Python iterators ??how to dynamically assign self.next within a new style class?

http://stackoverflow.com/questions/1152238/python-iterators-how-to-dynamically-assign-self-next-within-a-new-style-class

Example class IteratorWrapper1 def __init__ self otheriter self._iterator otheriter self.next otheriter.next def __iter__ self return.. def __iter__ self return self def close self if getattr self._iterator 'close' None is not None self._iterator.close # other arbitrary.. self if getattr self._iterator 'close' None is not None self._iterator.close # other arbitrary resource cleanup code here class IteratorWrapper2..