<div dir="auto"><div dir="auto">in that case you presented maybe it is more readeable but considering that lists as ["a","b"] can be inputted, not just using range, the result might be as it was. change x y people are happy change y and z people hate it<br><br><div data-smartmail="gmail_signature" dir="auto">Abdur-Rahmaan Janhangeer,<br>Mauritius<br><a href="http://abdurrahmaanjanhangeer.wordpress.com">abdurrahmaanjanhangeer.wordpress.com</a></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 13 Sep 2017 19:10, "Jason H" <<a href="mailto:jhihn@gmx.com">jhihn@gmx.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The format of map seems off. Coming from JS, all the functions come second. I think this approach is superior.<br>
<br>
Currently:<br>
map(lambda x: chr(ord('a')+x), range(26)) # ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']<br>
<br>
But I think this reads better:<br>
map(range(26), lambda x: chr(ord('a')+x))<br>
<br>
Currently that results in:<br>
TypeError: argument 2 to map() must support iteration<br>
<br>
Also, how are we to tell what supports map()?<br>
Any iterable should be able to map via:<br>
range(26).map(lambda x: chr(ord('a')+x)))<br>
<br>
While the line length is the same, I think the latter is much more readable, and the member method avoids parameter order confusion<br>
<br>
For the global map(),<br>
having the iterable first also increases reliability because the lambda function is highly variable in length, where as parameter names are generally shorter than even the longest lambda expression.<br>
<br>
More readable: IMHO:<br>
map(in, lambda x: chr(ord('a')+x))<br>
out = map(out, lambda x: chr(ord('a')+x))<br>
out = map(out, lambda x: chr(ord('a')+x))<br>
<br>
Less readable (I have to parse the lambda):<br>
map(lambda x: chr(ord('a')+x), in)<br>
out = map(lambda x: chr(ord('a')+x), out)<br>
out = map(lambda x: chr(ord('a')+x), out)<br>
<br>
But I contend:<br>
range(26).map(lambda x: chr(ord('a')+x)))<br>
is superior to all.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/<wbr>codeofconduct/</a><br>
</blockquote></div></div>