A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-June/054075.html below:

[Python-Dev] PEP 343 rewrite complete

[Python-Dev] PEP 343 rewrite completeDelaney, Timothy C (Timothy) tdelaney at avaya.com
Thu Jun 2 22:45:19 CEST 2005
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
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4