Nicolas Dumazet ha scritto: > A small note here: set is not really meant to be used on incremental > .add(), because sets are frozen (not mutable), and add() instantiates > a new set on each .add() action. Sets are useful for set operations > (union, intersection), but are not really helpful when it comes to > incrementally construct them. When I need performance for such kind of > lookups, a simple dictionary is usually way faster than sets :) I > would suggest using a dictionary here :)
'set' is implemented as a 'dict', using add() method you just are adding a new keyword, so using directly a 'dict' should be theorically faster. Unfortunately, I cannot see this in a test I have executed (1,23% slower). I'll try to run it again later. Maybe I miss something. -- Francesco Cosoleto Anyone can make mistakes, but only an idiot persists in his error. (Cicero) _______________________________________________ Pywikipedia-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
