Author rhettinger
Recipients habnabit, rhettinger
Date 2008-05-18.22:03:22
SpamBayes Score 0.0341796
Marked as misclassified No
Message-id <1211148206.48.0.0849031619309.issue2909@psf.upfronthosting.co.za>
In-reply-to
Content
Thanks for submitting the patch and the idea.

I've previously looked at this approach and decided against it.  The 
struct module is highly optimized and typically called many times in a 
loop and a patch like this would hurt performance.  Also, it adds 
complexity to the module making it more difficult to learn an remember.

It is better to leave named tuples separate and allow users to combine 
them downstream -- see the SQLite example for instance -- the cast to 
named tuples could be applied directly, so there was no need for a 
change to the SQL module.  It is better design for us to leave the data 
retrieval (struct, csv, sql, etc) separate from the code for 
collections.namedtuple.

Instead of this patch, I propose to add a simple example to the struct 
module documentation showing how to cast to a named tuple.  Also, 
FWIW,  the preferred way to cast tuples to named  tuples is to use the 
_make() method instead of using the constructor with the star 
operator.  nt._make(t) instead of nt(*t).
History
Date User Action Args
2008-05-18 22:03:28rhettingersetspambayes_score: 0.0341796 -> 0.0341796
recipients: + rhettinger, habnabit
2008-05-18 22:03:26rhettingersetspambayes_score: 0.0341796 -> 0.0341796
messageid: <1211148206.48.0.0849031619309.issue2909@psf.upfronthosting.co.za>
2008-05-18 22:03:25rhettingerlinkissue2909 messages
2008-05-18 22:03:23rhettingercreate