4 ms·
> Two, does Python need tuples, dicts, AND lists? While I agree that tuples and lists could be merged, I don't think that dicts should be merges with them, too
by vog 16y ago
> Two, does Python need tuples, dicts, AND lists?
While I agree that tuples and lists could be merged, I don't think that dicts should be merges with them, too.
When I first looked at PHP I found the concept of having a unified "array" type (for arrays and hash tables) very clever. However, I quickly changed my mind.
Now I think that the array/hash unification is one of the biggest design mistakes in PHP as it provides no benefit (both have completely different use cases), but causes a lot of trouble.
A similar argument goes for ECMA Script (aka JavaScript).
- silentbicycle 16y agoIt seems to work well for Lua, though it has an explicit optimization so that dicts with consecutive integer keys are automatically stored internally as an array.