Larry Hastings <[EMAIL PROTECTED]> 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.


I disagree.

    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.

 - Josiah

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to