Re: [Python-3000] None in Comparisons

2008-11-11 Thread Victor Stinner
Le Tuesday 11 November 2008 15:21:03 M.-A. Lemburg, vous avez écrit : > Because None is already special, has had this feature for a very > long time (...) Yeah, Python3 breaks compatibility by removing old dummy behaviour like comparaison between bytes and characters, or between an integer an Non

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Guido van Rossum
We're not going to add the "feature" back that None compares smaller than everything. It's a slippery slope that ends with all operations involving None returning None -- I've seen a proposal made in all earnestness requesting that None+42 == None, None() == None, and so on. This Nonesense was wise

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Terry Reedy
M.-A. Lemburg wrote: Why was the special case for None being "smaller" than all other objects in Python removed from Python 3.0 ? (see object.c in Py2.x) For one thing, it is only smallest when it controls the comparison. >>> class c(object): ... def __lt__(s,o): return True ... >>> cc = c()

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Tim Peters
[M.-A. Lemburg] > ... > That's fine. I'm just talking about the special case for None that > has existed in Python for years - and for a good reason. That's overstating it a bit ;-) In Python 1.5.1, comparisons were changed so that objects of numeric types compared smaller than objects of non-num

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Nov 11, 2008, at 8:54 AM, M.-A. Lemburg wrote: On 2008-11-11 14:28, Antoine Pitrou wrote: M.-A. Lemburg egenix.com> writes: Why was the special case for None being "smaller" than all other objects in Python removed from Python 3.0 ? (see objec

Re: [Python-3000] None in Comparisons

2008-11-11 Thread M.-A. Lemburg
On 2008-11-11 18:09, Guido van Rossum wrote: > We're not going to add the "feature" back that None compares smaller > than everything. It's a slippery slope that ends with all operations > involving None returning None -- I've seen a proposal made in all > earnestness requesting that None+42 == Non

Re: [Python-3000] cyclic imports worked in py2.6, fail in 3.0

2008-11-11 Thread Ondrej Certik
>> What it does is that it injects the classes defined in this particular >> module to the other modules. First problem: 2to3 tool doesn't convert >> this correctly, I had to manually conver this >> to: > > Would you file a bug report for the 2to3 problem, please? That should be > fixed. I will.

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > NULLs are a fact in life, not only in SQL, but also in numerics and > statistics. You often don't want a complex calculation or query to > fail just because a few input values are not available. But it only works in the case where you only do comparisons, an

Re: [Python-3000] None in Comparisons

2008-11-11 Thread M.-A. Lemburg
On 2008-11-11 14:28, Antoine Pitrou wrote: > M.-A. Lemburg egenix.com> writes: >> Why was the special case for None being "smaller" than all other >> objects in Python removed from Python 3.0 ? (see object.c in Py2.x) > > Because ordered comparisons (<, <=, >, >=) are much stricter in 3.0 than in

Re: [Python-3000] None in Comparisons

2008-11-11 Thread M.-A. Lemburg
On 2008-11-11 15:07, Barry Warsaw wrote: > On Nov 11, 2008, at 8:54 AM, M.-A. Lemburg wrote: > >> On 2008-11-11 14:28, Antoine Pitrou wrote: >>> M.-A. Lemburg egenix.com> writes: Why was the special case for None being "smaller" than all other objects in Python removed from Python 3.0 ?

Re: [Python-3000] None in Comparisons

2008-11-11 Thread M.-A. Lemburg
On 2008-11-11 15:22, Daniel Stutzbach wrote: > On Tue, Nov 11, 2008 at 7:06 AM, M.-A. Lemburg <[EMAIL PROTECTED]> wrote: > >> Why was the special case for None being "smaller" than all other >> objects in Python removed from Python 3.0 ? (see object.c in Py2.x) >> > > It wasn't true in Python 2.5

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > Why was the special case for None being "smaller" than all other > objects in Python removed from Python 3.0 ? (see object.c in Py2.x) Because ordered comparisons (<, <=, >, >=) are much stricter in 3.0 than in 2.x. In practice, ordered comparisons which do

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Greg Ewing
M.-A. Lemburg wrote: And here's another one: ... Two values that compare equal to each other (and are in fact identical), yet cannot be compared less-than or greater-than. That's not particularly surprising -- complex numbers have been like that for a long time. The only surprise, if any, is t

[Python-3000] None in Comparisons

2008-11-11 Thread M.-A. Lemburg
Why was the special case for None being "smaller" than all other objects in Python removed from Python 3.0 ? (see object.c in Py2.x) There's currently a discussion on c.l.p regarding this issue (see below). It looks like a bug in Python 3.0 to me, since None is widely used as "n/a" object in Pyth

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Antoine Pitrou
M.-A. Lemburg egenix.com> writes: > > >>> None > None > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: NoneType() > NoneType() > >>> None != None > False > > Two values that compare equal to each other (and are in fact identical), > yet cannot be comp

Re: [Python-3000] None in Comparisons

2008-11-11 Thread Greg Ewing
M.-A. Lemburg wrote: On 2008-11-11 14:28, Antoine Pitrou wrote: But why should "n/a" (or "missing", or "undefined") imply "smaller than everything else"? It's just a convention based on viewing None as "nothing" or the empty set. It would be possible to implement this convention in the sort