isi-vista / immutablecollections

A library for immutable collections, in the spirit of Guava's Immutable Collections.
MIT License
3 stars 1 forks source link

Add invert method to immutabledict which returns the immutabledict in the inverse order (i.e. the keys/value pairs switch their positions) #70

Open lichtefeld opened 4 years ago

gabbard commented 4 years ago

This is of course only possible when the keys are unique. Warn about this in the docstring, and use the forbid_duplicate_keys constructor argument to immutabledict to thrown an exception when the condition is not met.