> On 15 Feb 2021, at 9:48 PM, Ricky Teachey <[email protected]> wrote:
>
> hypotenuse(x,y): (x**2+y**2)**0.5
Can I use a named function (proposed here) as an argument to a function?
e.g.,
def example(func, x, y):
return func(x, y)
example(hypotenuse(x,y): (x**2+y**2)**0.5, 3, 4)
Or should it be an anonymous function like this?
example((x,y): (x**2+y**2)**0.5, 3, 4)
Maybe with named function, it would be something like this?
hypotenuse(x,y): (x**2+y**2)**0.5
example(hypotenuse, 3, 4)
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/AP5XQIAPE7O7MLV4J2DZABX6VXEDEPEB/
Code of Conduct: http://python.org/psf/codeofconduct/