Large Dictionaries

bearophileHUGS at bearophileHUGS at
Mon May 15 22:59:16 CEST 2006

Roy Smith:
> I am befuddled as to why
> people thought creating a dict by keyword would be a useful thing to
> do, but left out (and, indeed, eliminated the chance to add the syntax
> later) the obviously useful ability to hint at the size.

Adding the keyword syntax doesn't require much memory to a Python
programmer because it's the same syntax used elsewhere. While adding
another different method to dicts increases their API. Python is
usually designed to have smaller APIs, to help programmers remember
most things.

I agree that a reserve method to Python dicts/sets can be a little
useful, but Python programmers are usually more concerned about doing
things in a short programmer time and short code space, than telling
the computer how to do such things in the faster way (C++ is more for
speed so the reserve of the STL hashes can be more useful).


More information about the Python-list mailing list