Uh oh!
There was an error while loading. Please reload this page.
Chore: Added type hints to searches/binary_search.py - #2682
Conversation
hemanth-kotagiri
left a comment
There was a problem hiding this comment.
LGTM.
@Panquesito7, I approve of these changes. Please look into it.
Panquesito7
commented
Nov 8, 2020
Sorry, I'm not a Python developer/maintainer. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
UmairKamran
commented
Dec 9, 2020
Hey @hemanth-kotagiri, how can we get this merged? It's becoming stale |
hemanth-kotagiri
commented
Dec 9, 2020
@UmairKamran, I do not have the rights for this repository yet to merge your PR. What I'd suggest you is the email or ping @cclauss for the same. Thanks! |
dhruvmanila
commented
Dec 9, 2020
Closing and reopening this pull request to run checks done by the bot. |
dhruvmanila
left a comment
There was a problem hiding this comment.
Sorry for the delay. Small changes and this is good to go!
| def binary_search_std_lib(sorted_collection, item): | ||
| def binary_search_std_lib(sorted_collection, item) -> Optional[int]: |
There was a problem hiding this comment.
I think you missed a few in here :)
There was a problem hiding this comment.
Good catch! Looks like @cclauss has taken care of this
cclauss
commented
Dec 9, 2020
I will fix it and land it in the next few hours. Instead of parameters that can be either int or None, it would be better if they were only int where we use -1 as the signal value rather than None. |
dhruvmanila
commented
Dec 9, 2020
Ah, so you want to use the Sentinel pattern? There's a good article about it: https://python-patterns.guide/python/sentinel-object/ Any reason why you are preferring for an |
UmairKamran
commented
Dec 9, 2020
@dhruvmanila@cclauss Thank you for reviewing :) |
cclauss
commented
Dec 9, 2020
The expected datatype is int so why make things more complicated if we can find a suitable sentinel value of that datatype? The current project that I am working on overuses |
Describe your change:
Added missing type hints as described in this issue -> #2128
Checklist:
Fixes: #{$ISSUE_NO}.