Skip to content

Conversation

@shoracek
Copy link
Owner

No description provided.

from typing import Dict, List


def month_to_number(date: str) -> str:

Choose a reason for hiding this comment

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

There is not a check for None in date variable. There is however e.g. clean_date() function with the same parameter and it has a None check. It would be most likely better, if this was consistent.

return id, title, page


def postprocess_matches(matches: List[Tuple[str, str, str, str]]) \
Copy link

@xskrasek xskrasek May 22, 2021

Choose a reason for hiding this comment

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

If you know, that you might pass None as an argument, you can use Optional[str], which should be equal to Union[str, None]. It seems, that you check for None in the code itself, but this will increase code clarity and that is really useful in bigger python codebases.
This is similiar to Variable? in e.g. newer C# versions.
Found using beartype.

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.

3 participants