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

Should __get_item__() be reverted since it is confusing as to what the i-th entry of a Cigar is? #169

Open
yfarjoun opened this issue Jul 20, 2024 · 1 comment

Comments

@yfarjoun
Copy link
Contributor

There was a lively discussion here #155 and elsewhere about the merits of having a __len__ method in Cigar since there are meny possible interpretations of length.

in the same vein, one could argue that there are many interpretations of cigar[i]:

  • the I-th operator
  • the i-th cigar-element
  • the i-th character in the string representation
  • the offset in the read of the i-th base
  • the offset in the reference of the i-th base

Since we concluded that having len is a "footgun" and may cause more problems than it's worth, this issue hopes to embody the discussion for and against removing __get_item__ i.e. reverting #154

@yfarjoun
Copy link
Contributor Author

I agree that if one can do cigar[i] it can be understood that len(cigar)>i so that imposes a relationship between whatever it is we are counting with i when we use it in cigar[i] and the meaning of len(cigar), i.e. the meaning of __len__().

If we accept vetoing __len__() due to possible confusion with other length-adjacent concepts, it seems reasonable to me to not have __get_item__ thereby forcing the user to access elements explicitly, and also helping the reader understand the code.

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

No branches or pull requests

1 participant