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/053233.html below:

[Python-Dev] PEP 340 -- concept clarification

[Python-Dev] PEP 340 -- concept clarification [Python-Dev] PEP 340 -- concept clarificationPhillip J. Eby pje at telecommunity.com
Tue May 3 19:20:38 CEST 2005
At 09:53 AM 5/3/05 -0700, Guido van Rossum wrote:
>I just came across another use case that is fairly common in the
>standard library: redirecting sys.stdout. This is just a beauty (in
>fact I'll add it to the PEP):
>
>def saving_stdout(f):

Very nice; may I suggest 'redirecting_stdout' as the name instead?

This and other examples from the PEP still have a certain awkwardness of 
phrasing in their names.  A lot of them seem to cry out for a "with" 
prefix, although maybe that's part of the heritage of PEP 310.  But Lisp 
has functions like 'with-open-file', so I don't think that it's *all* a PEP 
310 influence on the examples.

It also seems to me that it would be nice if locks, files, sockets and 
similar resources would implement the block-template protocol; then one 
could simply say:

      block self.__lock:
          ...

or:

      open("foo") as f:
          ...

And not need any special wrappers.  Of course, this could only work for 
files if the block-template protocol were distinct from the normal 
iteration protocol.

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