3 ms·
Named tuples are nice in Python. I wonder how easy it is, though, to modify a namedtuple constructor to do argument validation and to allow for default field v
by nessus42 14y ago
Named tuples are nice in Python.
I wonder how easy it is, though, to modify a namedtuple constructor to do argument validation and to allow for default field values.
- TazeTSchnitzel 14y agoIf you see how namedtuple is implemented, you'd realise it's extremely easy. namedtuple uses eval(). It really shouldn't, since there are far better ways to do what it does, but it does.