On Tue, May 29, 2012 at 11:57 AM, Joachim Durchholz <[email protected]> wrote: > Am 29.05.2012 07:10, schrieb Aaron Meurer: > >> _hashable_content generally contains >> other Basic objects. So what I really want is the "fully denested" >> _hashable_content, where each Basic object is recursively replaced >> with its _hashable_content. I've no idea how expensive that would be >> to compute. > > > The behavior will be quadratic with number of levels of sets. This could > start to impact us on deeply nested expressions - not with anything a human > would enter, but if somebody wants to use SymPy from a script, this might be > different. (I'm talking of thousands of nesting levels.) > One way to set that might be to simplify x+0+0+...+0 (1000 terms, then retry > with 100,000 ;-) ). > > The downside of caching is that each mutator must invalidate the cached > hash. (Unless mutators are disallowed once an object is entered into a dict. > Or the mutable objects are really copy-on-write ones. I don't know whether > any of these paths is available already, or feasible if unavailable - we're > deep into Systems Programming Land here.)
In Python, only immutable objects are hashable, and in SymPy, all Basic subclasses are immutable, so this isn't an issue. Aaron Meurer -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
