On Thu, May 27, 2021 at 07:56:16AM -0000, Shreyan Avigyan wrote:
Lot of programming languages have something known as static variable
storage in *functions* not *classes*. Static variable storage means a
variable limited to a function yet the data it points to persists
until the end of the program.
+1 on this idea.
One common use for function defaults is to optimize function lookups to
local variables instead of global or builtins:
def func(arg, len=len):
# now len is a fast local lookup instead of a slow name lookup