[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This has come up several times in the past and never moved forward.  Part of 
the reason is that the mapping API doesn't translate cleanly to bidirectional 
lookups and it leaves users trapped if two keys every end up needing to be 
mapped to the same value (i.e. libre->free and gratis->free). Mostly, folks are 
better-off with two separate dictionaries augmented by a single function to 
create the initial pairing.  Also note that there are several bimaps published 
on PyPi but they have very low uptake.

If you want to pursue this further, I suggest bringing this to python-ideas 
(but first scan the archives for previous discussions and scan github for cases 
where projects have used one of the existing implementations).

--
nosy: +rhettinger
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Vedran Čačić

Vedran Čačić  added the comment:

Your implementation has many problems. First, almost all your complexity claims 
are wrong, probably because you copied them from Java, which uses balanced 
trees instead of Python's hash tables.
(Also, the method names seem to be copied from Java, using camelCase which is 
unusual for Python stdlib.)

Second, shouldn't _inverse be a weakkey dictionary? Otherwise many operations 
(e.g. removeValue) will get two dicts out of sync quickly.

--
nosy: +veky

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Jurjen N.E. Bos


Jurjen N.E. Bos  added the comment:

It is part of the Apache Common collections

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Is BiDiMap included in the Java SDK?

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44931] Add "bidimap" to collections library: a simple bidirectional map

2021-08-17 Thread Jurjen N.E. Bos


Change by Jurjen N.E. Bos :


--
title: Add "bidimap" to collections library -> Add "bidimap" to collections 
library: a simple bidirectional map

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com