Having the following function:
def foo(x=1):
print(x)
It is clearly stated in PEP 8 that no spaces should be used around the =
sign when used to indicate a keyword argument or a default parameter value.
If we want to type-annotate the x
parameter. How should we do it?
def foo(x:int=1):
def foo(x: int=1):
def foo(x: int = 1):
Is there a preferred way? Or even better, is it specified in some PEP? Did not find it in PEP 484.
The examples in PEP 484 all use
def foo(x: int = 1):
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With