Le lundi 23 mai 2011 à 18:33 -0300, Renato Coutinho a écrit : > On Mon, May 23, 2011 at 4:03 PM, Chris Smith <smi...@gmail.com> wrote: > > Aaron S. Meurer wrote: > >> On May 22, 2011, at 9:50 AM, Chris Smith wrote: > >> > >>> Ronan Lamy wrote: > >>>> Le dimanche 22 mai 2011 à 14:38 +0545, Chris Smith a écrit : > >>>>> > >>>>> I think that sets make more sense, too, but it's useful to > >>>>> have the > >>>>> variables in the output, and dicts are the easiest way to > >>>>> handle them. > >>>>> What about using sets of frozen dicts? Frozen dicts aren't > >>>>> builtins > >>>>> but there are simple free implementations (I just adapted > >>>>> one from > >>>>> http://code.activestate.com/recipes/414283/), that work in > >>>>> all python > >>>>> versions. They can easily be converted to/from dicts and > >>>>> subs should > >>>>> be able to use them directly. > > ... > > > >> -1. Even without guessing, referencing the solutions by the symbol > >> makes things easier to read and to reference programmatically. It's > >> much easier to say sol[x] than to figure out what position x was in > >> and call sol[i]. > > > > Well...then you can't have sets until the frozendict is implemented, so if > > you want sets then someone's gotta give the green light to the request > > above and be willing to push the commit. > > I believe I misunderstood Ronan's suggestion. I thought he was > suggesting to use the builtin set, not the Set class from core. I > think using Set would be too much of a hassle: it's not even an > iterable, so you wouldn't be able to pass it to subs or convert to a > dict. I agree with Chris that solve() has very basic problems that > should be addressed right now. > set() will do for now. Ideally, we should have a subclass of Set that behaves like set() (i.e. something that is to set what Tuple is to tuple) but it doesn't really matter for the current discussion.
> If we are going to use builtin sets, I put my adapted version of > FrozenDict here: > > https://gist.github.com/987629 > > Notice that frozen is not the same thing as hashable: all keys and > values (a restriction that plain dict doesn't impose) must be hashable > for that (like a tuple). > > If people are +1, this could go into core/containers? FrozenDicts are a problem by themselves. There are many subtly different implementations around and that's likely to cause confusion. I think we should only have them if we really need them. -- 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.