#16073: Python 3 preparation: The semantic of map() function is changed
-------------------------+-------------------------------------------------
Reporter: | Owner:
wluebbe | Status: needs_review
Type: | Milestone: sage-6.4
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers:
distribution | Work issues:
Keywords: | Commit:
python3 | 8331e848b1ab06e87ed5114926d941083ff0ae7f
Authors: | Stopgaps:
Wilfried Luebbe |
Report Upstream: N/A |
Branch: |
public/16073 |
Dependencies: |
-------------------------+-------------------------------------------------
Comment (by aapitzsch):
Replying to [comment:15 darij]:
> OK, but as I expected there are some questionable things here.
> {{{
> - r = sum ( map( lambda x: x[2], cycle ) )
> + r = sum ( [x[2] for x in cycle] )
> }}}
> Wouldn't keeping the old line be better? Summing an iterator should be
faster than summing a list which has been constructed merely to be summed.
You are right.
In this case we should write
{{{
r = sum ( (x[2] for x in cycle) )
}}}
Feel free to fix it (and others), currently I have no time to check the
necessity of {{{list()}}} wrapping.
--
Ticket URL: <http://trac.sagemath.org/ticket/16073#comment:17>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" 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/sage-trac.
For more options, visit https://groups.google.com/d/optout.