-
-
Notifications
You must be signed in to change notification settings - Fork 46.6k
Corrected filename and include static types #2440
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
Conversation
- The name of the file is now compliant with python naming conventions - Add static type as stated in contributing guidelines
Hi @NumberPiOso , Also I see that you included type hints for some variables too. Like: user_input: str = input("Enter numbers separated by comma:\n").strip()
sequence: List[int] = [int(item.strip()) for item in user_input.split(",")] etc. I think CONTRIBUTING.md says to provide type hints only for the input parameters and return values of functions and nothing else, because it causes too much visual clutter and Python is smart enough to figure it out. (There might be some exceptions to this but I don't know.) Good luck and happy coding! |
>>> print(binary_search(test_list, 3)) | ||
False | ||
>>> print(binary_search(test_list, 13)) | ||
True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for negative integers, floats, repeated numbers, letters, empty list, single element list.
Hi @spamegg1
It is because the other file was named simple-binary-search.py so I renamed it to simple_binary_search.py I did it using git mv, is there any other way to do this in order for github to show us the differences?
Totally agreed, I will correct it. Thank you. |
- Delete documentation line to run doctests - Delete type hints for variables that comes from functions Co-authored-by: Christian Clauss <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. It would be easier to review as two PRs. One that changed the filename and the other that changed the file contents.
* Corrected name and include static types - The name of the file is now compliant with python naming conventions - Add static type as stated in contributing guidelines * Apply suggestions from code review - Delete documentation line to run doctests - Delete type hints for variables that comes from functions Co-authored-by: Christian Clauss <[email protected]> * Add edge cases tests. * print(f"{target} was {not_str}found in {sequence}") Co-authored-by: Christian Clauss <[email protected]>
continuing in line with #2128.
My first time contributing code to open source so criticism is encouraged.
Describe your change:
Checklist: