2
When creating a class I can set some default values:
class Point:
def __init__(self, x, y, z=0):
self.x = x
self.y = y
self.z = z
How to proceed the same way for namedtuple?
from collection import namedtuple
Point = namedtuple('Point', 'x, y, z')
That’s what I want. Thanks. But you can set value to z only?
– britodfbr
I don’t think so, but it doesn’t serve to define others as
None
?– Sidon