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

  • Home
  • SEARCH
  • 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 8642601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:49:03+00:00 2026-06-12T11:49:03+00:00

if a function takes n number of arguments, and there is another function that

  • 0

if a function takes n number of arguments, and there is another function that returns a sequence with n number of items(or I have a sequence with n number of items), is there a way to ‘map’ these two functions(or make the first function take a sequence of n number of items as input and return result) I don’t want (and maybe can’t in some occasions) to edit the function myself and change its arguments parameters and return value types.

i.e)

def func1(x, y, z):
    return x+y+z

def func2(w):
    return [i for i in range(w,w+3)]

cant func1(func2( ... )) in this case.

  • 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-12T11:49:04+00:00Added an answer on June 12, 2026 at 11:49 am

    You are looking for the *args argument syntax:

    >>> def foo(bar, baz, spam):
    ...     print bar, baz, spam
    ...
    >>> arguments = [1, 2, 3]
    >>> foo(*arguments)
    1, 2, 3
    

    When passing arguments to a callable, any expression preceded by a * asterix, is interpreted as a sequence of positional arguments, and expanded to be passed on as separate arguments to the called object (function, method, etc.).

    For your example that would be:

    func1(*func2(...))
    

    There is a keyword equivalent using ** double asterixes (takes a mapping), and you can use the same syntax in function signatures too.

    See the documentation on call expressions, and for the function signature mirror syntax, the documentation on function definitions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP function that takes a variable number of arguments (using func_num_args()
Say I have a function that takes an arbitrary number of arguments (the last
Hi i have a function that takes an integer number n and returns a
I have a function that takes a variable number of arguments in C that
I have a function which takes any number of arguments and must call two
I have a logging function that takes in a variable number of arguments and
I have a function that takes variadic arguments. These arguments are parameter-value pairs, so
I have the following function that takes a number like 5 and creates a
I have a function called Colorbox (jQuery plugin) that takes a number of parameters
Say I have a function called addUp which takes any number of decimal arguments

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.