> Now, I can see that this method has some superfluous data (the `1`
> that is assigned to the dict). So I suppose this is less memory
> efficient. But is this slower then? As both implementations use hashes
> of the URL to access the data. Just asking out of curiosity ;)

Performance-wise, there is no difference in the implementations.
What matters when comparing programs one-by-one is how many method
calls you need. In this example, the dictionary is slightly faster
in my measurements, since for the set, you need to perform a lookup
of .add, whereas the access to __setitem__ for the dict need no
additional dictionary lookup.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to