Phillip J. Eby wrote: > That's not a bug, it's a feature. If the object doesn't have a > 'close()' > method, clearly it doesn't need to be closed. If it's the "wrong" > object > for what you're using it for in the body of the 'with' block, it'll > show up > there, so this doesn't hide any errors.
For those semantics, I think one of the following would be better: with local(obj): with scoped(obj): but those semantics apply better to __enter__ and __exit__ anyway. I think a "closing adaptor" should only work with objects that have a close() method. Perhaps: with scoped_closable(obj): Tim Delaney _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com