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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:51:16+00:00 2026-05-30T11:51:16+00:00

Based on this A positional argument is a name that is not followed by

  • 0

Based on this

A positional argument is a name that is not followed by an equal sign
(=) and default value.

A keyword argument is followed by an equal sign and an expression that
gives its default value.

def rectangleArea(width, height):
    return width * height

    
print rectangleArea(width=1, height=2)

Question. I assume that both width and height are positional arguments. Then why can we also call it with the keyword argument syntax?

  • 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-05-30T11:51:17+00:00Added an answer on May 30, 2026 at 11:51 am

    That text you quote seems to be confused about two totally different things:

    • Positional and keyword arguments are a feature of calls to a function (see Python reference section 5.3.4 Calls).
    • Default values are a feature of function definitions, as per section 7.6 Function definitions

    I suspect the people who put together that course-ware weren’t totally familiar with Python 🙂 Hence that link you provide is not a very good quality one.


    In your call to your function, you’re using the "keyword argument" feature (where the argument is named rather than relying on its position). Without that, values are bound to names based on order alone. So, in this example, the two calls below are equivalent:

    def process_a_and_b(a, b):
       blah_blah_blah()
    
    process_a_and_b(1, 2)
    process_a_and_b(b=2, a=1)
    

    By further way of example, refer to the following definition and calls:

    def fn(a, b, c=1):        # a/b required, c optional.
        return a * b + c
    
    print(fn(1, 2))            # returns 3, positional and default.
    print(fn(1, 2, 3))         # returns 5, positional.
    print(fn(c=5, b=2, a=2))   # returns 9, named.
    print(fn(b=2, a=2))        # returns 5, named and default.
    print(fn(5, c=2, b=1))     # returns 7, positional and named.
    print(fn(8, b=0))          # returns 1, positional, named and default.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on this question it appears that the default template for CheckStyle will allow
I have a group of text based rules that are structured like this: Rule
This code basically translates characters based on position in one string to the character
Based on this question I don't want to litter my ready stuff waiting for
Based on this article , it seems like SO is using Javascript OpenID Selector
Based on this , how would you make ignoring parameters more succint? var m
Based on this question I understand the purpose of the construct in linking C
This question is based on this thread . Is [---] a comment in Git
This question is based on this thread . I am interested in how Git
This question is based on this thread . The code function man() { man

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.