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

For reference, a correct #4 would read:

  with open("one_liners.py") as f: print f.readlines()
In CPython, a file handle is closed immediately the file goes out of scope, because it's reference-counted. In Jython (and I believe IronPython too), with lazier garbage collection, the filehandle would stay open until it was gc'd. I have no idea about PyPy's behaviour.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: