#16067: Python 3 preparation: The semantic of filter() function is changed
-------------------------------------+-------------------------------------
       Reporter:  wluebbe            |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  major              |    Milestone:  sage-6.3
      Component:  distribution       |   Resolution:
       Keywords:  python3            |    Merged in:
        Authors:                     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/wluebbe/ticket/16067             |  e574c6856980b83c05e687c4f8a50119972789c0
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by wluebbe):

 * commit:   => e574c6856980b83c05e687c4f8a50119972789c0
 * branch:   => u/wluebbe/ticket/16067


Comment:

 {{{2to3}}} does even better as its documentation
 [[https://docs.python.org/2.7/library/2to3.html#2to3fixer-filter|2to3
 filter]] suggests:[[br]]
 "Wraps filter() usage in a list call."

 Often it changes the code as indicated by
 [[https://docs.python.org/2.7/library/functions.html#filter|filter()]]:
 [[br]]
 "Note that {{{filter(function, iterable)}}} is equivalent to {{{[item for
 item in iterable if function(item)]}}} if function is not {{{None}}} and
 {{{[item for item in iterable if item]}}} if function is {{{None}}}."

 This is more readable and more pythonic as a combination of {{{filter}}}
 and {{{lamda}}}.
 And it allows sometimes further improvements!
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=e574c6856980b83c05e687c4f8a50119972789c0
 e574c68]||{{{trac #16067: changes generated by "2to3 -w -f filter
 src/sage"}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/16067#comment:2>
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.

Reply via email to