Can I use built-in functions to type parameters in my functions?
function 1
<code>def foo_foo(a=int(), b=int()):return a + b
</code>
<code>def foo_foo(a=int(), b=int()):return a + b
</code>
def foo_foo(a=int(), b=int()):return a + b
I understand that we can use hints for typing:
function 2
<code>def foo_foo(a: int, b: int):return a + b
</code>
<code>def foo_foo(a: int, b: int):return a + b
</code>
def foo_foo(a: int, b: int):return a + b
I wonder whether function 1 is somehow different from function 2. The results are the same.
I’ve tried both. They work without any issues.
New contributor
Tony_M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.