hash tables in pymacs
François Pinard
pinard at iro.umontreal.ca
Mon Sep 17 10:37:42 EDT 2001
More information about the Python-list mailing list
Mon Sep 17 10:37:42 EDT 2001
- Previous message (by thread): Pymacs - tuples/lists .vs. proper-lists/vectors
- Next message (by thread): Êîììåð÷åñêîå ïðåäëîæåíèå.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[John Wiegley] > Emacs 21 has hash table support, but perhaps converting dicts into > alists would be more natural? Or maybe a user option to specify > which? Pymacs 0.1 or 0.2 was converting Python dicts to Emacs alists. This was a mere toy to get experience with the Pymacs mechanics, not a serious idea. Despite I wanted "something" for dicts, this choice was not very satisfying: * Python dicts access speed are O(1), LISP alists are O(N). * Python dicts have no intrinsic order, LISP alists are really a sequence. * Python dicts have no duplicate keys, LISP alists may have shadows. The last two points, in particular, make that one cannot convert back and forth from LISP and have results which compare with `(equal ...)'. This makes the equivalence especially ugly: and this is why I removed it. Proper lists and vectors in LISP can be converted back and forth to Python and be `(equal ...)', which makes those equivalence more bearable. The idea was to postpone until a better idea pops up, than to put forward something which looked clearly wrong to me, and doomed to be replaced. Emacs LISP hash tables could be an acceptable equivalent for Python dicts. This is what Brian McErlean did, and suggests. My only reservation is about the need in Python that keys are non-mutable, while Emacs LISP seems to not have this limitation. Since by default, from LISP to Python, references are transmitted instead of contents, this would be a possible problem only when an expanded copy is requested from the Python side. This would never be a problem going from Python to Emacs, so far as I understand things now. -- François Pinard http://www.iro.umontreal.ca/~pinard
- Previous message (by thread): Pymacs - tuples/lists .vs. proper-lists/vectors
- Next message (by thread): Êîììåð÷åñêîå ïðåäëîæåíèå.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list