it looks like contextlib.closing fails to be idempotent, i.e. wrapping closing() around another closing() doesn't work.
This is annoying because the idea of closing() is to let you use legacy file-like objects as targets of the "with" statement, e.g. with closing(gzip.open(filename)) as zf: ... but what happens if the gzip library gets updated the dumb way to support the enter and exit methods so you don't need the explicit closing call any more? The dumb way of course is to just call closing() inside the library. It seems to me that closing(closing(f)) ought to do the same thing as closing(f). Let me know if I'm overlooking something. I'm thinking of submitting an RFE. -- http://mail.python.org/mailman/listinfo/python-list