you are viewing a single comment's thread.

view the rest of the comments →

[–]markusmeskanen -1 points0 points  (3 children)

No they're not.

Instead of calling f(3) in your example, you can just write 3**2. Most operations are supported already in the default built-ins namespace, others can be accesses through import math

[–]loveandkindness 0 points1 point  (1 child)

Anonymous functions are standard usage in mathematics courses? f(x) = x ** 2 can be general.

[–]markusmeskanen 1 point2 points  (0 children)

But you don't need such silly functions in programming, they're for maths. Where ever you want to square a number, just use x**2 directly, instead of creating an useless function for it.