Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] FrozenSetDict; FrozenSetCounter #42

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

[WIP] FrozenSetDict; FrozenSetCounter #42

wants to merge 5 commits into from

Conversation

dwhswenson
Copy link
Owner

@dwhswenson dwhswenson commented Oct 13, 2018

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