Created
April 22, 2010 16:30
-
-
Save eddyxu/375455 to your computer and use it in GitHub Desktop.
Trace Iterator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Trace: | |
"""A trace iterator | |
For each run of iteration, this object returns one trace entry | |
""" | |
def __init__(self, filepath): | |
self.filepath = filepath | |
self.fd = open(filepath) | |
def __enter__(self): | |
return self | |
def __exit__(self, type, value, traceback): | |
self.fd.close() | |
def __iter__(self): | |
return self | |
def next(self): | |
raise "You have to override this(Trace::next) method" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment