A confused user on c.l.py reported that while
for x in file.xreadlines():
blows up with
TypeError: argument 2 to map() must be a sequence object
The docs say both contexts require "a sequence", so this is baffling to them.
It's apparently because map() internally insists that the sq_length slot be non-null (but it's null in the xreadlines object), despite that map() doesn't use it for anything other than *guessing* a result size (it keeps going until IndexError is raised regardless of what len() returns, growing or shrinking the preallocated result list as needed).
I think that's a bug in map(). Anyone disagree?
If so, fine, map() has to be changed to work with iterators anyway <wink>.
How are we going to identify all the places that need to become iterator-aware, get all the code changed, and update the docs to match? In effect, a bunch of docs for arguments need to say, in some words or other, that the args must implement the iterator interface or protocol. I think it's essential that we define the latter only once. But the docs don't really define any interfaces/protocols now, so it's unclear where to put that.
Fred, Pronounce. Better sooner than later, else I bet a bunch of code changes will get checked in without appropriate doc changes, and the 2.2 docs won't match the code.