Different orderings in dictionaries is expected behavior and shouldn't be 
causing any bugs (because the dictionary is basically an unordered container).  
I really have a hard time understanding what is going on here actually.

By the way, going back to the original code, you shouldn't be calling expand in 
a @property method because those are supposed to be (relatively) cheap, and 
expand() in general is not.

Aaron Meurer

On Sep 7, 2010, at 4:09 PM, smichr wrote:

> OK, I think it's something that happens when expand is called. Perhaps
> due to caching? If I put e = self.expand(mul=1) above the loop over
> self.symbols then I get two errors. I go to the releveant code in test
> pickling and print out the attribute and the values of a and b that
> are being compared as follows:
> 
>                attr = getattr(a,i)
>                if not hasattr(attr, "__call__"):
>                    assert hasattr(b,i), i
>                    got = getattr(b,i)
> 
>                    if got != attr:
>                        print '-'*22
>                        print 'attr=',i
>                        print type(a), a
>                        print type(b), b
>                        print attr
>                        print got
> 
>                    assert got==attr
> 
> Here is the output:
> 
> attr= __dict__
> <class 'sympy.printing.mathml.MathMLPrinter'>
> <sympy.printing.mathml.MathMLPrint
> er object at 0x0E382D90>
> <class 'sympy.printing.mathml.MathMLPrinter'>
> <sympy.printing.mathml.MathMLPrint
> er object at 0x0E72AC10>
> {'reverse': False, 'dom': <xml.dom.minidom.Document instance at
> 0x0E722DC8>, '_s
> ettings': {'order': None, 'encoding': 'utf-8'}, '_str': <type 'str'>,
> '_print_le
> vel': 0, 'order': None}
> {'reverse': False, 'dom': <xml.dom.minidom.Document instance at
> 0x0E7404E0>, '_s
> ettings': {'order': None, 'encoding': 'utf-8'}, '_print_level': 0,
> '_str': <type
> 'str'>, 'order': None}
> 
> The dictionaries have the same entries but the xml instance is at a
> different location now and the print_level and str entries switched
> places.
> 
> attr= _mhash
> gamma gamma(1 + x)
> gamma gamma(1 + x)
> None
> 777405089
> 
> Here the attribute _mhash is None or that other number for the gamma
> object.
> 
> Any ideas?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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