Performance: sets vs dicts.

Stefan Behnel stefan_ml at behnel.de
Tue Aug 31 10:19:49 EDT 2010


Jerry Hill, 31.08.2010 14:24:
> On Mon, Aug 30, 2010 at 7:42 PM, Aahz wrote:
>> Possibly; IMO, people should not need to run timeit to determine basic
>> algorithmic speed for standard Python datatypes.
>
> http://wiki.python.org/moin/TimeComplexity takes a stab at it.  IIRC,
> last time this came up, there was some resistance to making promises
> about time complexity in the official docs, since that would make
> those numbers part of the language, and thus binding on other
> implementations.

The docs start getting clearer about what's language specification and 
what's implementation specific to CPython, so that would just add another 
couple of CPython-only bits to what's there already. Although I do consider 
facts like list indexing being O(1) pretty much at the 
language-rather-than-implementation level. Most Python code simply expects 
that and it would degrade a lot of code if that ever changed in whatever 
implementation.

Stefan




More information about the Python-list mailing list