Skip to content

Feat/allow int candidates#370

Draft
graceg571 wants to merge 2 commits into
mggg:3.4.1from
graceg571:feat/allow-int-candidates
Draft

Feat/allow int candidates#370
graceg571 wants to merge 2 commits into
mggg:3.4.1from
graceg571:feat/allow-int-candidates

Conversation

@graceg571

@graceg571 graceg571 commented Jun 1, 2026

Copy link
Copy Markdown

Closes #359 (partial - RankBallot only)

Allows integer candidates as input to RankBallot ranking argument, in addition to the existing string support.

Implementation

  • Widened RankingLike type alias to accept integer and string candidates
  • Normalized in RankBallot.__init__ to preserve RankBallot.ranking storage as tuple[frozenset(str)].
  • Can have mixed string or int candidates. All converts to string. 1 == "1"

Reconsidering having mixed candidate inputs. May be better to enforce all int or str candidates even if they are stored as strings within the RankBallot object because 1 == "1" is not true and would create one candidate when the user could have intended two.

ScoreBallot is not yet included. The blocker is ScoreBallot.scores is stored as a dict where the key type is invariant. We would not mix string and integer candidate names within the same ScoreBallot, and scores would be stored as strings.

Requires #368 first

@graceg571 graceg571 marked this pull request as draft June 1, 2026 14:56
@graceg571 graceg571 self-assigned this Jun 1, 2026
@graceg571 graceg571 force-pushed the feat/allow-int-candidates branch from c7d7185 to ac74d1d Compare June 12, 2026 15:47
@graceg571 graceg571 changed the base branch from main to 3.4.1 June 12, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Request to allow candidates to be integers

1 participant