A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/attachments/20140217/e64e3934/attachment.html below:

<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 17 February 2014 11:14, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">On 15.02.2014 07:03, Stephen J. Turnbull wrote:<br>

> M.-A. Lemburg writes:<br>


><br>
> Â > IMO, it was a mistake to have None return a TypeError in<br>
> Â > comparisons, since it makes many typical data operations<br>
> Â > fail, e.g.<br>
><br>
> I don't understand this statement. Â The theory is that they *should*<br>
> fail.<br>
><br>
> The example of sort is a good one. Â Sometimes you want missing values<br>
> to be collected at the beginning of a list, sometimes at the end.<br>
> Sometimes you want them treated as top elements, sometimes as bottom.<br>
> And sometimes it is a real error for missing values to be present.<br>
> Not to mention that sometimes the programmer simply hasn't thought<br>
> about the appropriate policy. Â I don't think Python should silently<br>
> impose a policy in that case, especially given that the programmer may<br>
> have experience with any of the above treatments in other contexts.<br>
<br>
</div>None is special in Python and has always (and intentionally) sorted<br>
before any other object. In data processing and elsewhere in Python<br>
programming, it's used to signal: no value available.<br>
<br>
Python 3 breaks this notion by always raising an exception when<br>
using None in an ordered comparison, making it pretty much useless<br>
for the above purpose.<br>
<br>
Yes, there are ways around this, but none of them are intuitive.<br>
<br>
Here's a particularly nasty case:<br>
<br>
>>> l = [(1, None), (2, None)]<br>
>>> l.sort()<br>
>>> l<br>
[(1, None), (2, None)]<br>
<br>
>>> l = [(1, None), (2, None), (3, 4)]<br>
>>> l.sort()<br>
>>> l<br>
[(1, None), (2, None), (3, 4)]<br>
<br>
>>> l = [(1, None), (2, None), (3, 4), (2, 3)]<br>
<div class="">>>> l.sort()<br>
Traceback (most recent call last):<br>
  File "<stdin>", line 1, in <module><br>
</div>TypeError: unorderable types: int() < NoneType()<br>
<span class=""><font color="#888888"><br></font></span></blockquote><div><br></div><div>Maybe Python 3 should have a couple of None-like objects that compare the way you want: AlwaysComparesLess and AlwaysComparesGreater, but with better names (maybe 'PlusInfinity' and 'MinusInfinity'?). Â Just leave None alone, please.</div>
<div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><font color="#888888">
--<br>
Marc-Andre Lemburg<br>
eGenix.com<br>
<br>
Professional Python Services directly from the Source Â (#1, Feb 17 2014)<br>
</font></span><div class="im">>>> Python Projects, Consulting and Support ... Â  <a href="http://www.egenix.com/" target="_blank">http://www.egenix.com/</a><br>
>>> mxODBC.Zope/Plone.Database.Adapter ... Â  Â  Â  <a href="http://zope.egenix.com/" target="_blank">http://zope.egenix.com/</a><br>
>>> mxODBC, mxDateTime, mxTextTools ... Â  Â  Â  Â <a href="http://python.egenix.com/" target="_blank">http://python.egenix.com/</a><br>
________________________________________________________________________<br>
2014-02-12: Released mxODBC.Connect 2.0.4 ... Â  Â  <a href="http://egenix.com/go53" target="_blank">http://egenix.com/go53</a><br>
<br>
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::<br>
<br>
  Â eGenix.com Software, Skills and Services GmbH Â Pastor-Loeh-Str.48<br>
  Â  D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg<br>
  Â  Â  Â  Â  Â Registered at Amtsgericht Duesseldorf: HRB 46611<br>
  Â  Â  Â  Â  Â  Â  Â <a href="http://www.egenix.com/company/contact/" target="_blank">http://www.egenix.com/company/contact/</a><br>
</div><div class=""><div class="h5">_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/gjcarneiro%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/gjcarneiro%40gmail.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr">Gustavo J. A. M. Carneiro<div>Gambit Research LLC<br>"The universe is always one step beyond logic." -- Frank Herbert</div>
</div>
</div></div>

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4