Thanks Aaron, that works. One of these days, I will actually learn
Python and be able to come up with such fixes myself.

On Apr 19, 4:09 pm, "Aaron S. Meurer" <[email protected]> wrote:
> Lists are unhashable in every Python.  If you want to use them as keys in a 
> dictionary, you have to use tuples instead.  You can probably fix it by doing
>
> dict([ (tuple(map(int, monom)), coeff) for monom, coeff in M[0,0] ])
>
> (though I haven't tried it).
>
> Aaron Meurer
> On Apr 19, 2010, at 1:43 PM, Ben Goodrich wrote:
>
>
>
> > Hi Mateusz,
>
> > I think I understand but ...
>
> > On Apr 19, 12:13 pm, Mateusz Paprocki <[email protected]> wrote:
> >> They look identical, but they're not. As you use F.as_dict(), then in
> >> both cases c_i are of type Integer. However, keys of _50 and _51 are
> >> different. In _50 M_i are tuples of Integer instances and in _51 they
> >> are tuples of ints. When you created a Matrix of FF then FF got sympified
> >> and all ints were converted to Integers. Poly, however, expects M_i to
> >> have int exponents. To solve this problem you can replace dict(M[0,0])
> >> with:
>
> >>  dict([ (map(int, monom), coeff) for monom, coeff in M[0,0] ])
>
> > this results in an error
>
> > In [12]: dict([ (map(int, monom), coeff) for monom, coeff in M[0,0] ])
> > ---------------------------------------------------------------------------
> > TypeError                                 Traceback (most recent call
> > last)
>
> > /tmp/mattpap-sympy-polys-cd30a32/<ipython console> in <module>()
>
> > TypeError: list objects are unhashable
>
> > Maybe you meant something slightly different? Or is it another Python
> > 2.5 vs 2.6 thing?
>
> > Thanks,
> > Ben
>
> > --
> > 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 
> > athttp://groups.google.com/group/sympy?hl=en.
>
> --
> 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 
> athttp://groups.google.com/group/sympy?hl=en.

-- 
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.

Reply via email to