
Functional Python Programming
By :

There are three ways we can build namedtuple
instances. The choice of technique we use is generally based on how much additional information is available at the time of object construction.
We've shown two of the three techniques in the examples in the previous section. We'll emphasize the design considerations here. It includes the following choices:
We can provide the parameter values according to their positions. This works out well when there are one or more expressions that we were evaluating. We used it when applying the haversine()
function to the start
and end
points to create a Leg
object.
Leg(start, end, round(haversine(start, end),4))
We can use the *argument
notation to assign parameters according to their positions in a tuple. This works out well when we're getting the arguments from another iterable or an existing tuple. We used it when using map()
to apply the float()
function to the latitude
and longitude
values.
Point(*map...
Change the font size
Change margin width
Change background colour