On Sun, Feb 26, 2012 at 11:58 PM, Joachim Durchholz <j...@durchholz.org> wrote: > Am 26.02.2012 20:05, schrieb Sergiu Ivanov: > >> As a functional programming beginner and fan, I can't but agree. I >> was actually quite happy when I heard for the first time that SymPy >> had immutable core, because that allows for much clearer and better >> structured code (at least I see it so). > > > Hm... there's the question what an "immutable core" actually is. Is it the > mathematical objects that the user sees, or is it an internal API for > programmers?
I thought it referred to the fact that SymPy is immutable "in the large"; i.e., side-effects are allowed on a small scale (some simple flags, counters, etc.), but separate entities stay away from modifications. At least, this is my (very basic) understanding of how SymPy is organised. > In the former case, I'd avoid mutability. It's just a conceptual hassle, it > makes semantics-preserving transformations harder (as soon as references are > involved, prohibitively hard for a project of SymPy's scale - you need alias > analysis, and compiler teams spend person-decades on that kind of stuff). Yes, that's precisely what I meant, but expressed with better terminology and more detail :-) > In the latter case, there's nothing wrong with it. Sure, coding just with > immutable data is fun and far less error-prone, but Python is not built for > that coding style; I suspect such code would be very clean but not very > efficient. Yes, I get it; I'd say what I meant when I joined the discussion was something more similar to the former case of the two you describe. Sergiu -- 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.