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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:38:02+00:00 2026-06-11T14:38:02+00:00

I am learning to use positional arguments in python and also trying to see

  • 0

I am learning to use positional arguments in python and also trying to see how they work when mixed up with default arguments:-

def withPositionalArgs(ae=9,*args):
    print 'ae= ', ae
    print 'args = ', args


a=1
b=2
c=[10,20]

withPositionalArgs(a,b,c)

This gives me the output:

ae=  1
args =  (2, [10, 20])

As you can see, a is considered to be a value passed for ae, and b as well as c are considered to be the positional arguments.

So, I am now trying to assign 10 for ae while calling withPositionalArgs:

withPositionalArgs(ae=10,b,c)

But, I can not do it. I get the error:

SyntaxError: non-keyword arg after keyword arg

My question is:

Am I doing correctly? Is having default argument allowed or a good practice to use before positional arguments in python functions?

  • 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-11T14:38:03+00:00Added an answer on June 11, 2026 at 2:38 pm

    In Python2, you are not allowed to put arguments which have a default value before positional arguments.

    The positional arguments must come first, then the arguments with default values (or, when calling the function, the keyword arguments), then *args, and then **kwargs.

    This order is required for both the function definition and for function calls.

    In Python3, the order has been relaxed. (For example, *args can come before a keyword argument in the function definition.) See PEP3102.

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

Sidebar

Related Questions

I'm learning to use raw sockets, and im trying to prase out the tcp
I'm learning about parameterization and I see some queries use this notation :varname in
I am a real beginner learning to use Python using Zed Shaw's Learn Python
I'm just learning how to use the C4 framework and trying to add gestures
I am learning to use GWT with App Engine in Eclipse. I included the
I am just learning to use Services, and am sort of stuck. I have
i am learning to use SO_SNDTIMEO and SO_RCVTIMEO to check the timeout. It is
I'm just learning to use lazy sequences in Clojure, and I'm not sure what
I am learning to use Subversion and am experimenting. I checked out a copy
I'm learning to use vlad the deployer and I've got a question. Since I'm

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.