Skip to content

Conversation

@liam-m
Copy link
Owner

@liam-m liam-m commented Oct 27, 2019

No description provided.

if not self or self[-1] < prime:
super().extend(primes_up_to(prime, self)[len(self):])
return super().index(prime)
return super().index(prime, start, stop or len(self))
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange that we have to do stop or len(self), but without it we get

primes.py:61: error: Argument 3 to "index" of "list" has incompatible type "Optional[int]"; expected "int"

"""

def __contains__(self, item):
def __contains__(self, item: Any) -> bool:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally all of these parameters would be int rather than Any

@liam-m liam-m merged commit f9f5040 into master Oct 27, 2019
@liam-m liam-m deleted the initial-typing branch October 27, 2019 14:19
@liam-m liam-m mentioned this pull request Oct 27, 2019
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.

2 participants