Dustan DustanGroups at
Sun Feb 24 13:18:31 CET 2008

On Feb 24, 5:11 am, gert <gert.cuyk... at> wrote:
> what is the difference between iter(, ') and
> iter(,'') ?

One does not work, and one is syntactically incorrect:

>>> iter(,'')

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
TypeError: iter(v, w): v must be callable
>>> iter(, ')

SyntaxError: EOL while scanning single-quoted string

To clarify: returns the next 8192 bytes of the file in a string, or
whatever is leftover, or an empty string when the file is exhausted.
lambda: is a function that will return the next 8192
bytes of the file every time it is called.

So iter(,'') is evaluated as iter(some_string, ''). When
iter receives two arguments, it expects the first to be a function,
not a string.

iter(, '') (what you probably meant) is what it
looks like: iter(some_func, '').

More information about the Python-list mailing list