[Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement
Giovanni Bajo
rasky at develer.com
Tue Mar 3 02:53:09 CET 2009
On Mon, 02 Mar 2009 14:36:32 -0800, Raymond Hettinger wrote:
> [Nick Coghlan]
>> The examples in the PEP used 'odict' (until recently), but the patch
>> was for OrderedDict.
>
> As an experiment, try walking down the hall asking a few programmers who
> aren't in this conversion what they think collections.odict() is?
> Is it a class or function? What does it do? Can the English as second
> language folks guess what the o stands for? Is it a builtin or pure
> python? My guess is that the experiment will be informative.
Just today, I was talking with a colleague (which is learning Python
right now) about "ordered dict". His first thought was a dictionary that,
when iterated, would return keys in sorted order.
I beleive he was partly misguided by his knowledge of C++. C++ has always
had std::map which returns sorted data upon iteration (it's a binary
tree); they're now adding std::unordered_map (and std::unordered_set), to
be implemented with a hash table. So, if you come from C++, it's easy to
mistake the meaning of an ordered dict.
This said, I don't have a specific suggestion, but I would stay with
lowercase-only for simmetry with defaultdict.
--
Giovanni Bajo
Develer S.r.l.
http://www.develer.com
More information about the Python-Dev
mailing list