Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What are the mistakes there?


f doesn't refer to anything.

iterating over the file object at all instead of just calling self.cache = openFile.readlines() means that calling strip() the line below removes data beyond just the trailing newlines.


The most obvious one:

    with open(self.file_path, 'r') as openFile:
        for line in f:
`f` does not exist. It should be `openFile`.


One is that the variable is called openFile and not f. I don't know enough python to see something else wrong with that but would love to know too, since I've written such a line just last week.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: