Josiah Carlson wrote:
> 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
>   

I realize I'm in the minority here, but I prefer to use tuples only as 
lightweight frozen lists of homogeneous objects.  I understand the 
concept that a tuple is a frozen container of heterogeneous objects 
referenced by position, it's considered a perfectly Pythonic idiom, it 
has a long-standing history in mathematical notation... I *get* it, I 
just don't *agree* with it.

Better to make explicit the association of data with its name.  x.dingus 
is simply better than remembering "the ith element of x is the 
'dingus'".  The examples you cite don't sway me; I'd be perfectly happy 
to use a positionless "record" that lacked the syntactic shortcuts you 
suggest.  I stand by my assertion above.

At least now you know "where I'm coming from",


/larry/
_______________________________________________
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