[Python-Dev] PyObject_RichCompareBool identity shortcut (original) (raw)
Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 28 08:02:29 CEST 2011
- Previous message: [Python-Dev] PyObject_RichCompareBool identity shortcut
- Next message: [Python-Dev] PyObject_RichCompareBool identity shortcut
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Stephen J. Turnbull wrote:
So what does the 1/0 that occurs in [1/x for x in range(-5, 6)] mean? In what sense is it "equal to itself"? How can something which is not a number be compared for numerical equality?
I would say it can't be compared for numerical equality. It might make sense to compare it using some other notion of equality.
One of the problems here, I think, is that Python only lets you define one notion of equality for each type, and that notion is the one that gets used when you compare collections of that type. (Or at least it's supposed to, but the identity- implies-equality shortcut that gets taken in some places interferes with that.)
So if you're going to decide that it doesn't make sense to compare undefined numeric quantities, then it doesn't make sense to compare lists containing them either.
-- Greg
- Previous message: [Python-Dev] PyObject_RichCompareBool identity shortcut
- Next message: [Python-Dev] PyObject_RichCompareBool identity shortcut
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]