Python version of perl's "if (-T ..)" and "if (-B ...)"?

Hrvoje Niksic hniksic at
Wed Feb 17 20:18:39 CET 2010

Tim Chase <python.list at> writes:

>     if portion is None:
>       content = iter(f)

iter(f) will iterate over lines in the file, which doesn't fit with the
rest of the algorithm.  Creating an iterator that iterates over
fixed-size file chunks (in this case of length 1) is where the
two-argument form of iter comes in handy:

    content = iter(lambda:, '')

More information about the Python-list mailing list