<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">Concatenation is the most fundamental operation that can be done on iterators. In fact, we already do that with lists.<br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> [1, 2, 3] + [4, 5, 6]</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> # evaluates to [1, 2, 3, 4, 5, 6]</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">I propose:</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> iter([1, 2, 3]) + iter([4, 5, 6])</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> # evaluates to something like itertools.chain(iter([1, 2, 3]), iter([4, 5, 6]))</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> # equivalent to iter([1, 2, 3, 4, 5, 6])</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">There is some python2 code where:</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> a = dict(zip('abcd', range(4)))</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> isinstance(a.values(), list)</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> alphabet = a.keys() + a.values()</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">In python2, this `alphabet` becomes a list of all values and keys</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">In current python3, this raises:</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"> TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_values'<br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small"><br>
</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">But in my proposal, it works just fine. `alphabet` becomes an iterator over all values and keys (similar to the python2 case).</div>
<div style="color:rgb(34,34,34); font-family:arial,sans-serif; font-size:small">
<div><br>
</div>
Sincerely,<br>
<div class="gmail_signature">
<div dir="ltr"><font face="arial" size="2">Sam G</font></div>
</div>
</div>
</div>
</body>
</html>