Skip to content

Instantly share code, notes, and snippets.

@DavidPiper94
Last active September 24, 2019 14:25
Show Gist options
  • Save DavidPiper94/88334968d1f6506d093fdb9ec3196da3 to your computer and use it in GitHub Desktop.
Save DavidPiper94/88334968d1f6506d093fdb9ec3196da3 to your computer and use it in GitHub Desktop.
Example code for article about mypy - Example 2
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)
@DavidPiper94
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment