core.py file in 0.7.3 vs 0.7.4.1 diff

12 views
Skip to first unread message

Robert

unread,
Jul 22, 2014, 12:56:45 PM7/22/14
to sy...@googlegroups.com
I notice that there are multiple lines that now create lists and do not use iteritems:


from:
        sequence = filter(None, sequence)
to: 
        sequence = list(filter(None, sequence))


multiple places where .items() is now used instead of .iteritems().

like:
                    _value = lambda expr, result: (value(**dict([ (
                        str(key)[:-1], val) for key, val in result.iteritems()]))
to:
                    _value = lambda expr, result: (value(**dict([ (
                        str(key)[:-1], val) for key, val in result.items()]))



Generally my understanding is that using iterators is preferred to creating a list especially when iterating. Is there a benefit to using items() over iteritems() for iterations?

Thanks,
Rob

Aaron Meurer

unread,
Jul 22, 2014, 1:03:10 PM7/22/14
to sy...@googlegroups.com
In that version we changed from using 2to3 to using a single codebase
to support Python 3. In Python 3, there is no more iteritems, and
filter always returns an iterator (in that example, it must be
indexing against the sequence at some point, or iterating through it
more than once).

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/e2a09072-2827-42bf-b7b0-34c02a573027%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Robert

unread,
Jul 24, 2014, 4:16:12 PM7/24/14
to sy...@googlegroups.com
aw that's useful to know.

Thanks,
Rob
Reply all
Reply to author
Forward
0 new messages