Last active
September 24, 2019 14:25
-
-
Save DavidPiper94/88334968d1f6506d093fdb9ec3196da3 to your computer and use it in GitHub Desktop.
Example code for article about mypy - Example 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List, Optional | |
def position_of(string: str, list: List[str]) -> Optional[int]: | |
if not string in list: return None | |
return list.index(string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Link to article: https://medium.com/@HeyDaveTheDev/static-type-checking-in-python-with-mypy-4df617e066c2