[Python-ideas] Proposal for extending the collections module - bags / multisets, ordered sets / unique lists

Nick Coghlan ncoghlan at gmail.com
Sun Jul 19 22:07:40 CEST 2009


Mike Meyer wrote:
> Saving time for people who are used to having a well-designed
> hierarchy of collections by letting them not waste time dealing with
> name differences over implementation details. Things like repeating
> myself by writing foo_for_sets and foo_for_dicts and foo_for_lists, or
> changing method names, or mapping between two representations so I can
> use code that chose one set of names, or dealing with the headaches of
> maintaining two copies of a structure.

Blurring semantic distinctions (add != append) to make
overgeneralisation easier doesn't sound like a good idea to me.

Choose the data structure that makes the most sense for the current
algorithm. If someone gives you a different data structure, convert it
at the beginning and convert it back at the end (think of it as a
variant of the decorate-sort-undecorate approach to sorting).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list