From 68fce064dc5bdf320a519078ed567b28652a3b2d Mon Sep 17 00:00:00 2001 From: Mark Pilgrim Date: Thu, 16 Jul 2009 08:39:31 -0400 Subject: [PATCH] asterisk notation for doing apply()-like function calling isn't really new --- porting-code-to-python-3-with-2to3.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/porting-code-to-python-3-with-2to3.html b/porting-code-to-python-3-with-2to3.html index 37b05c8..5b5704b 100644 --- a/porting-code-to-python-3-with-2to3.html +++ b/porting-code-to-python-3-with-2to3.html @@ -516,8 +516,6 @@ for an_iterator in a_sequence_of_iterators:
  • Again, no changes are necessary, because the list comprehension will iterate through the entire sequence, and it can do that just as well if filter() returns an iterator as if it returns a list. -

    FIXME -

    map() global function

    In much the same way as filter(), the map() function now returns an iterator. (In Python 2, it returned a list.) @@ -571,7 +569,7 @@ reduce(a, b, c)

    apply() global function

    -

    Python 2 had a global function called apply(), which took a function f and a list [a, b, c] and returned f(a, b, c). In Python 3, the apply() function no longer exists. Instead, there is a new function calling syntax that allows you to pass a list and have Python apply the list as the function’s arguments. +

    Python 2 had a global function called apply(), which took a function f and a list [a, b, c] and returned f(a, b, c). You can accomplish the same thing by calling the function directly and passing it the list of arguments preceded by an asterisk. In Python 3, the apply() function no longer exists; you must use the asterisk notation.
    Notes