9 March 2021

Some Leftovers

picture of a lamb

Lambdas Lambdas are function literals, much like 4.5 is a float literal or "fooment" is a string literal.

They look like this.


lambda arg(s): expr

The item arg(s) is a parameter list that can consist of zero or more items. The item expr is an expression combining the parmeters.

Two ways to define a function

A use case for lambdas

Python is a pass-by-value language Remember this: Python variables store the heap addresses of their objects.

A Dangerous Bend Mutable objects passed to functions can be changed. We shall learn about the "pink house principle."

An Important for Loop Note