[Python-Dev] python 3 niggle: None < 1 raises TypeError
mal at egenix.com
Mon Feb 17 13:30:25 CET 2014
On 17.02.2014 13:19, Serhiy Storchaka wrote:
> 17.02.14 13:56, M.-A. Lemburg написав(ла):
>> Yes, but that's not the point. Unlike strings or other mixed types that
>> you cannot compare, None is used as placeholder in data processing as
>> special value to mean "no value available".
> Isn't float('nan') such placeholder?
You can easily construct other such placeholders, but None was intended
for this purpose:
The Python None object, denoting lack of value. ...
>> You intentionally use such values in programming. It's not a bug to
>> have None in a data list or as value of a variable.
> You can't have None in array('f'), you can't add or multiply by None. Relation operators don't looks
> an exception here. Applying sorted() to a list which contains numbers and Nones makes as much sense
> as applying sum() to it.
Of course, you cannot apply any operations with None - it doesn't
have a value -, but you can compare it to other objects and it provides
a consistent behavior in Python 2. Python 3 is missing such an object.
Professional Python Services directly from the Source (#1, Feb 17 2014)
>>> Python Projects, Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
2014-02-12: Released mxODBC.Connect 2.0.4 ... http://egenix.com/go53
::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611
More information about the Python-Dev