Larry Hastings email@example.com wrote:
For new code, I can't think of a single place I'd want to use a "NamedTuple" where a "record" wouldn't be arguably more suitable. The "NamedTuple" makes sense only for "fixing" old APIs like os.stat.
def add(v1, v2) return Vector(i+j for i,j in izip(v1,v2))
x,y,z = point
And more are examples where not having a defined ordering (as would be the case with a 'static dict') would reduce its usefulness. Having a defined ordering (as is the case of lists and tuples) implies indexability (I want the ith item in this sequence!). It also allows one to use a NamedTuple without change otherwise anywhere you would have previously used a tuple (except for doctests, which would need to be changed). This was all discussed earlier.