Skip to content

[WIP] FrozenSetDict; FrozenSetCounter#42

Draft
dwhswenson wants to merge 5 commits into
masterfrom
set_dict
Draft

[WIP] FrozenSetDict; FrozenSetCounter#42
dwhswenson wants to merge 5 commits into
masterfrom
set_dict

Conversation

@dwhswenson

@dwhswenson dwhswenson commented Oct 13, 2018

Copy link
Copy Markdown
Owner

To handle contact pairs, we frequently use dictionaries/counters where the keys are a frozenset of the indices. This gets very annoying to deal with, especially when writing unit tests (so many things need to be wrapped in frozenset).

This PR creates a couple simple classes, FrozenSetDict and FrozenSetCounter, that use the frozensets internally, but allow the user to access them with tuples or lists (of either indices or the actual objects).

  • FrozenSetDict
  • test for FrozenSetDict
  • FrozenSetCounter
  • tests for FrozenSetCounter
  • use FrozenSetDict/FrozenSetCounter in main code wherever useful
  • update old tests for readability (use lists instead of frozenset wrappers)
  • docstrings

@dwhswenson dwhswenson marked this pull request as draft August 12, 2020 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant