<div dir="ltr">Cf. <a href="https://martinfowler.com/bliki/CommandQuerySeparation.html">https://martinfowler.com/bliki/CommandQuerySeparation.html</a><br><div><br></div><div>But:</div><div><br></div><div><div>>>> l = [1,2,3]</div><div>>>> l.pop()</div><div>3</div><div>>>> l</div><div>[1, 2]</div></div><div><br></div><div>=> Not so true.</div><div><br></div><div>  S.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 1, 2017 at 11:10 AM, Stephan Houben <span dir="ltr"><<a href="mailto:stephanh42@gmail.com" target="_blank">stephanh42@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It's even in the Programming FAQ:<div><br></div><div>"<span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify">In general in Python (and in all cases in the standard library) a method that mutates an object will return </span><code class="m_-2061038493810756205gmail-docutils m_-2061038493810756205gmail-literal" style="background-color:rgb(236,240,243);padding:0px 1px;font-size:0.95em;color:rgb(0,0,0);text-align:justify"><span class="m_-2061038493810756205gmail-pre">None</span></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify"> to help avoid getting the two types of operations confused. So if you mistakenly write </span><code class="m_-2061038493810756205gmail-docutils m_-2061038493810756205gmail-literal" style="background-color:rgb(236,240,243);padding:0px 1px;font-size:0.95em;color:rgb(0,0,0);text-align:justify"><span class="m_-2061038493810756205gmail-pre">y.sort()</span></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify"> thinking it will give you a sorted copy of </span><code class="m_-2061038493810756205gmail-docutils m_-2061038493810756205gmail-literal" style="background-color:rgb(236,240,243);padding:0px 1px;font-size:0.95em;color:rgb(0,0,0);text-align:justify"><span class="m_-2061038493810756205gmail-pre">y</span></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify">, you’ll instead end up with </span><code class="m_-2061038493810756205gmail-docutils m_-2061038493810756205gmail-literal" style="background-color:rgb(236,240,243);padding:0px 1px;font-size:0.95em;color:rgb(0,0,0);text-align:justify"><span class="m_-2061038493810756205gmail-pre">None</span></code><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify">, which will likely cause your program to generate an easily diagnosed error."</span></div><span class="HOEnZb"><font color="#888888"><div><span style="color:rgb(0,0,0);font-family:sans-serif;font-size:16px;text-align:justify"><br></span></div><div style="text-align:justify"><font color="#000000" face="sans-serif"><span style="font-size:16px">Stephan</span></font></div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-03-01 10:31 GMT+01:00 Paul Moore <span dir="ltr"><<a href="mailto:p.f.moore@gmail.com" target="_blank">p.f.moore@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 1 March 2017 at 01:31, qhlonline <<a href="mailto:qhlonline@163.com" target="_blank">qhlonline@163.com</a>> wrote:<br>
> My code example is not proper,  Yes,  may be this is better:<br>
> list.sort().revers(<br>
<br>
</span>We can already do this - reversed(sorted(lst))<br>
<br>
This is a long-established design decision in Python. It would need a<br>
*very* compelling use case to even think about changing it.<br>
<span class="m_-2061038493810756205HOEnZb"><font color="#888888">Paul<br>
</font></span><div class="m_-2061038493810756205HOEnZb"><div class="m_-2061038493810756205h5">______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br></div>
</div></div><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><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Stefane Fermigier - <a href="http://fermigier.com/" target="_blank">http://fermigier.com/</a> - <a href="http://twitter.com/sfermigier" target="_blank">http://twitter.com/sfermigier</a> - <a href="http://linkedin.com/in/sfermigier" target="_blank">http://linkedin.com/in/sfermigier</a><br>Founder & CEO, Abilian - Enterprise Social Software - <a href="http://www.abilian.com/" target="_blank">http://www.abilian.com/</a><br>Chairman, Free&OSS Group / Systematic Cluster - <a href="http://www.gt-logiciel-libre.org/" target="_blank">http://www.gt-logiciel-libre.org/</a><br>Co-Chairman, National Council for Free & Open Source Software (CNLL) - <a href="http://cnll.fr/" target="_blank">http://cnll.fr/</a><div>Founder & Organiser, PyData Paris - <a href="http://pydata.fr/" target="_blank">http://pydata.fr/</a><br></div><div>---</div><div><div>“You never change things by fighting the existing reality. To change something, build a new model that makes the existing model obsolete.” <span style="font-size:12.8px">— R. Buckminster Fuller</span></div></div><div><br><br></div></div></div></div></div></div></div></div>
</div>