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 105753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:29:20+00:00 2026-05-11T01:29:20+00:00

Does * have a special meaning in Python as it does in C? I

  • 0

Does * have a special meaning in Python as it does in C? I saw a function like this in the Python Cookbook:

def get(self, *a, **kw) 

Would you please explain it to me or point out where I can find an answer (Google interprets the * as wild card character and thus I cannot find a satisfactory answer).

  • 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. 2026-05-11T01:29:20+00:00Added an answer on May 11, 2026 at 1:29 am

    See Function Definitions in the Language Reference.

    If the form *identifier is present, it is initialized to a tuple receiving any excess positional parameters, defaulting to the empty tuple. If the form **identifier is present, it is initialized to a new dictionary receiving any excess keyword arguments, defaulting to a new empty dictionary.

    Also, see Function Calls.

    Assuming that one knows what positional and keyword arguments are, here are some examples:

    Example 1:

    # Excess keyword argument (python 3) example: def foo(a, b, c, **args):     print("a = %s" % (a,))     print("b = %s" % (b,))     print("c = %s" % (c,))     print(args)      foo(a="testa", d="excess", c="testc", b="testb", k="another_excess") 

    As you can see in the above example, we only have parameters a, b, c in the signature of the foo function. Since d and k are not present, they are put into the args dictionary. The output of the program is:

    a = testa b = testb c = testc {'k': 'another_excess', 'd': 'excess'} 

    Example 2:

    # Excess positional argument (python 3) example: def foo(a, b, c, *args):     print("a = %s" % (a,))     print("b = %s" % (b,))     print("c = %s" % (c,))     print(args)          foo("testa", "testb", "testc", "excess", "another_excess") 

    Here, since we’re testing positional arguments, the excess ones have to be on the end, and *args packs them into a tuple, so the output of this program is:

    a = testa b = testb c = testc ('excess', 'another_excess') 

    You can also unpack a dictionary or a tuple into arguments of a function:

    def foo(a,b,c,**args):     print("a=%s" % (a,))     print("b=%s" % (b,))     print("c=%s" % (c,))     print("args=%s" % (args,))  argdict = dict(a="testa", b="testb", c="testc", excessarg="string") foo(**argdict) 

    Prints:

    a=testa b=testb c=testc args={'excessarg': 'string'} 

    And

    def foo(a,b,c,*args):     print("a=%s" % (a,))     print("b=%s" % (b,))     print("c=%s" % (c,))     print("args=%s" % (args,))  argtuple = ("testa","testb","testc","excess") foo(*argtuple) 

    Prints:

    a=testa b=testb c=testc args=('excess',) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 67k
  • Answers 67k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer As several others have pointed out in general this is… May 11, 2026 at 11:49 am
  • added an answer I have been told that a good toolkit for doing… May 11, 2026 at 11:49 am
  • added an answer This should work $(window).bind('resize', function() { alert('Resizing now'); }); May 11, 2026 at 11:49 am

Related Questions

Does * have a special meaning in Python as it does in C? I
Using C# .NET 2.0, I have a composite data class that does have the
Does anyone have a definitive answer to whether Sql Server Management Objects is compatible
Does anyone have a technique for generating SQL table create (and data insert) commands
Does anyone have a good way to build MSI (vdproj) projects using MsBuild or
Does Python have a unit testing framework compatible with the standard xUnit style of
Does anyone have a trusted Proper Case or PCase algorithm (similar to a UCase
Does Java have a built-in way to escape arbitrary text so that it can
Does anyone have a suggestion for where to find archives or collections of everyday
Does PHP have a method of having auto-generated class variables? I think I've seen

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.