As mentioned in the above comments, Optional[str] is a type-hint to be used by IDEs and other static analysis tools, not a default argument . If you want to make a default argument such that you can call the function with a() , then you do need to add = None as you proposed.
What is optional str in Python?
As mentioned in the above comments, Optional[str] is a type-hint to be used by IDEs and other static analysis tools, not a default argument . If you want to make a default argument such that you can call the function with a() , then you do need to add = None as you proposed.