itertools, functools, file enhancement ideas

Paul Rubin http
Sun Apr 8 12:34:59 EDT 2007


rdhettinger at gmail.com writes:
> >        for block in f.iterchars(n=1024):  ...
> for block in iter(partial(f.read, 1024), ''): ...

Hmm, nice.  I keep forgetting about that feature of iter.  It also came
up in a response to my queue example from another post.

> >       a) def flip(f): return lambda x,y: f(y,x)
> Curious resemblance to:
>    itemgetter(1,0)

Not sure I understand that.  



More information about the Python-list mailing list