Reputation: 21
Is there a boundary on list and dictionary in python? if there is, what is the limit?
Upvotes: 2
Views: 266
Reputation: 110261
Actually, currently hash implementation for inner Python objects use 32 bit hashes --so, at a point close to 2^32 elements on a dictionary (assuming you have memory for that much), you will start to have a lot of collisions, and will have a significant slow down in dictionary usage. But that won't prevent it from working.
(Python devels are looking at making this hash 64 bit in future builds, so this is no longer an issue).
As for absolute limit, there is none - the limiting factor is the available system memory.
Upvotes: 3
Reputation: 26586
I think by boundary you mean whether there is an upper bound on the number of elements in a list
or dict
. Python does not define any limits on them, so they can be as big as the memory available on your machine permits.
Upvotes: 6