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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:47:08+00:00 2026-06-08T19:47:08+00:00

So I am trying out the new python code for the google app engine

  • 0

So I am trying out the new python code for the google app engine search library and I came across a weird syntax. This was:

cls_createDocument(**params)

where params was a dictionary.

The function this refers to is:

    @classmethod
  def _createDocument(
      cls, pid=None, category=None, name=None, description=None,
      category_name=None, price=None, **params)

My questions is, what does the **params signify and what does that do to the object?

Thanks!
Jon

  • 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-08T19:47:09+00:00Added an answer on June 8, 2026 at 7:47 pm

    Consider a function with default arguments:

    def func(foo=3):
        print(foo)
    

    The structure of the arguments is (in principle) very similar to a dictionary. The function foo has (essentially) a dictionary of default arguments (in this case {'foo':3}). Now, lets say that you don’t want to use the keyword in the function call, but you want to use a dictionary instead — then you can call foo as:

    d = {"foo":8}
    func(**d)
    

    This allows you to dynamically change what arguments you are passing to the function func.

    This become a little more interesting if you try the following:

    d = {"foo":8, "bar":12}
    func(**d)
    

    This doesn’t work (it is equivalent to foo(foo=8, bar=12), but since bar isn’t a valid argument, it fails).

    You can get around that problem by giving those extra arguments a place to go inside the definition of foo.

    def func( foo=3, **kwargs ):
        print(foo,kwargs)
    

    Now, try:

    d = {"foo":8, "bar":12}
    func(**d)  #prints (8, {'bar':12})
    

    All the extra keyword arguments go into the kwargs dictionary inside the function.

    This can also be called as:

    func(foo=8, bar=12)
    

    with the same result.

    This is often useful if funcA calls funcB and you want funcA to accept all of the keywords of funcB (plus a few extra) which is a very common thing when dealing with classes and inheritance:

    def funcA(newkey=None,**kwargs): 
        funcB(**kwargs)
    

    Finally, here is a link to the documentation

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

Sidebar

Related Questions

I'm new to python, django and google app engine. All great tools and have
I am very new to Python, and trying to figure out how to create
So I'm trying out this new TDD thing (about time haha). Anyways I have
I am new to backbone and trying out my first app after going through
Hi iam new to c++ and iam trying out this vector program and i
I'm new to MongoDB and trying out some fundamentals, but this astonished me. I'm
I'm trying to insert new records into SQLite database from Python code. con =
I'm trying to adapt this python code I found for connecting to the Dropbox
I am new to python (and this site); I am trying to write a
I am fairly new to Python and I am trying to figure out the

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.