<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
1) It always sucks when moving from lists to iterators.<br>
2) As you showed, transition to Python 3 is made easier.<br>
<br>
Thus: +1 for me<br>
<br>
<div class="moz-cite-prefix">On 05.08.2015 02:22, Grayson, Samuel
Andrew wrote:<br>
</div>
<blockquote
cite="mid:BN3PR0101MB0977A40972C19761083AEF15C0750@BN3PR0101MB0977.prod.exchangelabs.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Python-ideas mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-ideas@python.org">Python-ideas@python.org</a>
<a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a>
Code of Conduct: <a class="moz-txt-link-freetext" href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a></pre>
</blockquote>
<br>
</body>
</html>