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

[Python-Dev] iter alternate form and *args and **kwargs (Was: Wishlist: dowhile)

[Python-Dev] iter alternate form and *args and **kwargs (Was: Wishlist: dowhile) [Python-Dev] iter alternate form and *args and **kwargs (Was: Wishlist: dowhile)Benji York benji at benjiyork.com
Thu Jun 16 05:07:05 CEST 2005
Steven Bethard wrote:
> It reminds me of one of my minor gripes about the standard lib -- a
> number of functions that take another function as an argument don't
> take *args and **kwargs to be passed to that function when it's
> called. The iter() alternate form is a common example of this. I
> would prefer that the alternate iter() form was broken off into
> another separate function, say, iterfunc(), that would let me write
> Jp's solution something like:
> 
> for chunk in iterfunc('', f1.read, CHUNK_SIZE):
>     f2.write(chunk)

How about 2.5's "partial":

for chunk in iter(partial(f1.read, CHUNK_SIZE), ''):
     f2.write(chunk)
--
Benji York

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