I have a question about collections.namedtuple function:
Consider the following example:
...
Point = collections.namedtuple('Point', 'x y')
p = Point(1,2)
print (p.x)
...
It works fine, but I can change first arg of this function:
...
Point = collections.namedtuple('Circle', 'x y')
p = Point(1,2)
print (p.x)
...
It also works. From this I've concluded that the object on the left side of the equality operator defines the name of a "new type", but I don't understand how the link on the return-value can be used as an argument. Can you explain it to me, please?
Created at: May 20, 2015, 9:37 a.m.; Updated at: May 25, 2015, 7:20 p.m.