A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-May/053813.html below:

[Python-Dev] PEP 343 - Abstract Block Redux

[Python-Dev] PEP 343 - Abstract Block Redux [Python-Dev] PEP 343 - Abstract Block ReduxPhillip J. Eby pje at telecommunity.com
Mon May 16 19:22:03 CEST 2005
At 04:51 PM 5/16/2005 +1200, Greg Ewing wrote:
>Phillip J. Eby wrote:
> > This makes it seem awkward for e.g. "do self.__lock", which doesn't
> > make any sense.  But the extra call needed to make it "do
> > locking(self.__lock)" seems sort of gratuitous.
>
>How about
>
>    do holding(self.__lock):

I simply mean that having to have any wrapper at all for common cases seems 
silly.


>It doesn't work so well when you don't already have an
>object with one obvious interpretation of what you want
>to do 'with' it, e.g. you have a pathname and you want
>to open a file.

Um, what's wrong with 'with open("filename") as f'?


>  I've already argued against giving file
>objects __enter__ and __exit__ methods. And I'm -42 on
>giving them to strings. :-)

If strings had them, __enter__ would return self, and __exit__ would do 
nothing.  I fail to see a problem.  :)

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