<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">On Sat, Dec 1, 2018, 11:54 AM Steven D'Aprano <<a href="mailto:steve@pearwood.info">steve@pearwood.info</a> wrote:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
# current behaviour<br>
mo = map(lambda x: x, "aardvark")<br>
list(islice(mo, 3))  # discard the first three items<br>
assert ''.join(mo) == 'dvark'<br>
=> passes<br>
<br>
# future behaviour, with your proposal<br>
assert ''.join(mo) == 'dvark'<br>
=> fails with AssertionError<br><br>
Given the certainty that this change will break code (I know it will <br>
break *my* code, as I often rely on map() being an iterator not a <br>
sequence) it might be better to introduce a new "mapview" type rather than change the behaviour of map() itself. On the other hand, since the fix is simple enough:<br>
<br>
mo = iter(mo)<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Given that the anti-fix is just as simple and currently available, I don't see why we'd want a change:</div><div dir="auto"><br></div><div dir="auto"># map->sequence</div><div dir="auto">mo = list(mo)</div><div dir="auto"><br></div><div dir="auto">FWIW, I actually do write exactly that code fairly often, it's not hard.</div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>