[Python-Dev] Getting values stored inside sets (original) (raw)
Paul Moore p.f.moore at gmail.com
Fri Apr 3 19:56:44 CEST 2009
- Previous message: [Python-Dev] Getting values stored inside sets
- Next message: [Python-Dev] Getting values stored inside sets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2009/4/3 R. David Murray <rdmurray at bitdance.com>:
a == b
So, python calls a.eq(b) Now, that function does: a.key == b Since b is an object with an eq method, python calls b.eq(a.key).
That's the bit I can't actually find documented anywhere.
Ah, looking again I see that I misread the section describing the rich comparison methods:
""" There are no swapped-argument versions of these methods (to be used when the left argument does not support the operation but the right argument does); rather, lt() and gt() are each other’s reflection, le() and ge() are each other’s reflection, and eq() and ne() are their own reflection. """
I read that as meaning that no "reversed" version was called, whereas it actually means that eq is its own reversed version - and so gets called both times.
Thanks for helping me clear that up!
Paul.
- Previous message: [Python-Dev] Getting values stored inside sets
- Next message: [Python-Dev] Getting values stored inside sets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]