reverse dict lookup & Relation class

Aaron Brady castironpi at gmail.com
Sun Jan 18 02:54:48 CET 2009


On Jan 17, 10:45 am, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> On Sat, 17 Jan 2009 00:24:21 -0800, Aaron Brady wrote:
> > Can you make it work for a 3-way lookup?
>
> What do you mean "3-way lookup"?
>
> I'm going to take a guess...
>
> A maps to B, B maps to C, and C maps to A.
>
> Is that what you mean?

So long as you can get B and C from A, and C and A from B, and A and B
from C, it classifies as a "3-way lookup", or at least how I was using
the term.  (In other words, yes.)

Yours does that, but it takes two steps from B to A.  For example:

c2a[ b2c[ keyinB ] ] == keyinA

This goes from B to C, then from C to A.  From what you said, you
would have no way to get from B directly to A.  Is that correct?  If
so, it's a little awkward, and the direct way would be nice too.




More information about the Python-list mailing list