On Fri, Feb 6, 2009 at 7:32 PM, er <eroberer...@gmail.com> wrote: > Thanks Chris. Lua tables are one of my favorite linguistic traits, which > was actually part of the discussion that brought up this nugget. > Nevertheless, any details you care to provide about the details. I'm going > to dive into the source code in more depth tomorrow, just so I can get a > better understanding anyway, but I'd love to hear some details, or see any > links, if you have them.
Yeah, as Chris said, Python lists are not dictionaries at all. They're PyObjects that contain an array of pointers to other PyObjects. Basic Python types try to be efficient and reliable. They're not always the perfect choice, but they strive to be good enough for most situations in terms of both functionality and speed... and while they have put a lot of effort into tuning Python's hash implementation, an array has to beat it hands down when you're implementing an ordered sequence. Now, I believe Python sets *are* for all intents and purposes dictionaries, but I think that's just because its the easiest and most efficient way to implement their uniqueness properties; they took the very-well-tuned dictionary implementation and cut out the stuff not needed by sets and did some tweaks here or there. I /believe/. --S -- http://mail.python.org/mailman/listinfo/python-list