Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8075763
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:05:51+00:00 2026-06-05T15:05:51+00:00

The Python 2 documentation says: Built-in Functions: map(function, iterable, …) Apply function to every

  • 0

The Python 2 documentation says:

Built-in Functions: map(function, iterable, ...)

Apply function to every item of iterable and return a list of the
results. If additional iterable arguments are passed, function must
take that many arguments and is applied to the items from all
iterables in parallel.

If one iterable is shorter than another it is assumed to be extended
with None items.

If function is None, the identity function is assumed; if there are
multiple arguments, map() returns a list consisting of tuples
containing the corresponding items from all iterables (a kind of
transpose operation).

The iterable arguments may be a sequence or any iterable object; the
result is always a list.

What role does this play in making a Cartesian product?

content = map(tuple, array)

What effect does putting a tuple anywhere in there have? I also noticed that without the map function the output is abc and with it, it’s a, b, c.

I want to fully understand this function. The reference definitions is also hard to understand. Too much fancy fluff.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T15:05:53+00:00Added an answer on June 5, 2026 at 3:05 pm

    map isn’t particularly pythonic. I would recommend using list comprehensions instead:

    map(f, iterable)
    

    is basically equivalent to:

    [f(x) for x in iterable]
    

    map on its own can’t do a Cartesian product, because the length of its output list is always the same as its input list. You can trivially do a Cartesian product with a list comprehension though:

    [(a, b) for a in iterable_a for b in iterable_b]
    

    The syntax is a little confusing — that’s basically equivalent to:

    result = []
    for a in iterable_a:
        for b in iterable_b:
            result.append((a, b))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Python documentation says that os.rename(src, dst) ... On Windows, if dst already exists, OSError
There are many escape functions in the Python module mysqldb whose documentation I don't
As the title says I am using Sphinx to generate documentation for a python
The os.walk documentation ( http://docs.python.org/library/os.html ? highlight=os.walk#os.walk), says I can skip traversing unwanted directories
In the python built-in open function, what is the exact difference between the modes
The Python documentation for except says: For an except clause with an expression, that
I have a question about __class__ in python. The documentation says that __class__ is
The Python documentation says that sys.path is Initialized from the environment variable PYTHONPATH ,
The documentation of the Python readline module says Availability: Unix. However, it doesn't appear
The Python documentation about the is operator says: The operators is and is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.