I have a method with signature as follows:
def get_users_for_survey(survey_id: (int, str),show_deleted_users: bool = False) -> list:
pass
I have avoided the method body because I am only interested in the type hinting part for survey_id? Looks like it means it could be either int or str. I thought if that was the intention then it should have been survey_id: Union(int,str). PyCharm is not objecting. Do you think I missed something in PEP 484? I do not think it was meant to be a tuple.
Edit As per answers provided here, this is just a mistake. Now I know what is the origin of this mistake. In the same method next line was:
if survey_id and isinstance(survey_id, (int, str)):
So you see in isinstance if you want to accommodate for multiple types this is a valid syntax. Author of this method thought this is a valid syntax for type hinting as well.Here is a reference: Python isinstance with multiple types