More thoughts on named tuples after trying-out all of Michele's suggestions:

* The lowercase 'namedtuple' seemed right only because it's a function, but
as a factory function, it is somewhat class-like.  In use, 'NamedTuple' more
closely matches my mental picture of what is happening and distinguishes
what it does from the other two entries in collections, 'deque' and 
'defaultdict'
which are used to create instances instead of new types.

* I remembered why the __repr__ function had a 'show' argument.  I've
changed the name now to make it more clear and added a docstring.
The idea was the some use cases require that the repr exactly match
the default style for tuples and the optional argument allowed for that
possiblity with almost no performance hit.

The updated recipe is at 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/500261


Raymond
_______________________________________________
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