Op zaterdag 03-10-2009 om 22:40 uur [tijdzone +0300], schreef Xan Lopez:
On Sat, Oct 3, 2009 at 10:24 PM, Magnus Therning <magnus therning org> wrote:Objects in JavaScript are dictionaries (I mean, even the syntax is the same...), and I'm sure there's plenty of implementations of data structures like Python sets around.No, they are "dictionary-like", not proper dictionaries. For instance keys can only be strings or numbers.So what else can be a key in Python dictionaries exactly? The documentation mentions a tuple of immutable objects, which I guess can have its uses, but saying that javascript does not have dictionaries (or only "dictionary-like" objects) because of this seems a bit over the top to be honest.
Anything that can be hashed can be used as a dictionary key. For objects, the key can be simply the memory address. This is very useful for object-to-something dictionaries. — Wouter
Attachment:
signature.asc
Description: Dit berichtdeel is digitaal ondertekend