Well, independent of the architectural issues, this seems like a 
(significant?) regression.   The attached file fails (at least for me) for 
Python3 with a current git build, where it presumably was OK when we used 
2to3 on the Python3 version.

What is the best way to fix?   Edit the iteritems uses by hand?  Or 
something more ambitious/automated?

If the former, I am willing to attempt a PR.

On Monday, November 25, 2013 8:31:49 AM UTC-8, Chris Smith wrote:
>
> OK, we don't use 2to3...but there are several uses of iteritems still in 
> the codebase. These must be uncovered lines which don't cause anybody 
> trouble if they aren't running in 3. We should clean them up, though, 
> shouldn't we?
>
>   C:\Users\chris.smith\sympy\doc\ext\docscrape.py (1 hits)
> Line 379:         for section, references in idx.iteritems():
>   C:\Users\chris.smith\sympy\doc\ext\docscrape_sphinx.py (1 hits)
> Line 138:         for section, references in idx.iteritems():
>   C:\Users\chris.smith\sympy\sympy\core\compatibility.py (1 hits)
> Line 542:         return 1 + sum(_nodes(k) + _nodes(v) for k, v in 
> e.iteritems())
>   C:\Users\chris.smith\sympy\sympy\functions\elementary\trigonometric.py 
> (1 hits)
> Line 585:                 a = [n//x**y for x, y in 
> factorint(r.q).iteritems()]
>   C:\Users\chris.smith\sympy\sympy\polys\polycontext.py (1 hits)
> Line 43:             [ '%s=%r' % (key, value) for key, value in 
> self.__options__.iteritems() ])
>
> In this file, a workaround is given by not using the attribute, but bu 
> defining a 2x or 3x compatible function, `iteritems`:
>   C:\Users\chris.smith\sympy\sympy\mpmath\calculus\differentiation.py (7 
> hits)
> Line 5:     iteritems = dict.iteritems
> Line 7:     iteritems = dict.items
> Line 372:     R = dict((c+(0,),v) for (c,v) in iteritems(R))
> Line 374:     for powers, count in iteritems(R):
> Line 380:     for powers, count in iteritems(R):
> Line 443:         for powers, c in iteritems(dpoly(i)):
>
> I'll post this as an issue that can be closed if I am wrong about the need 
> to eliminate this.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.
from __future__ import print_function
# This snippet works with python2, but NOT with python3 
from sympy.core.compatibility import ordered
print(list(ordered([{1:3, 2:4, 9:10}, {1:3}])))

Reply via email to