Am 01.07.2012 09:07, schrieb Ondřej Čertík:
Maybe you can figure out some way which is hash() independent and
still fast. At least I didn't figure it out.

I'd try something like this:

a) Yes, use native dicts as much as possible. Trying to improve over a core data structure that's getting unlimited love from the language team doesn't sound like a winning idea to me :-)
b) Keep the sorted list of keys in a separate member variable.
c) Create the sorted key list lazily (i.e. only when it's actually needed).
d) Destroy the sorted list on every operation that changes the set of keys.

This is based on the assumption that operations that need the sorted list are far, far rarer than operations that modify the set of keys. (Without that, we're in serious trouble.)

Has this approach been tried already?

--
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to