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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:15:52+00:00 2026-05-26T15:15:52+00:00

This is really a few questions: Is there a reason argparse uses a namespace

  • 0

This is really a few questions:

  1. Is there a reason argparse uses a namespace instead of a dictionary?

  2. Assuming I have a class with __init__(self, init_method, *args). The init_method parameter tells the init_function which way I want to initialize the class, while arg parameter gives all the arguments neccesary for the init. The arguments may be different for different methods. Should I use a dictionary, or a namespace?

  3. Assuming that I use a namespace, how do I pass the namespace to __init__()?

  • 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-26T15:15:53+00:00Added an answer on May 26, 2026 at 3:15 pm
    1. The designers of arparse apparently felt it would be more convenient to access arguments as

      args.arg_name
      

      rather than

      args["arg_name"]
      

      This might be a matter of taste, though. I would have happily gone with the dictionary, especially given the fact that there is no Namespace class in the standard library, except for the one in argparse.

    2. Use a dictionary.

    3. If you really want a namespace here, you can use init_function(**args.__dict__)…but I don’t recommend it.

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

Sidebar

Related Questions

There have been a few questions like this around the place but none have
This is really a few questions in one, I'm wondering what the performance cost
There are a few questions that approach an answer to this question, but none
Hey all, this will contain a few questions since I don't seem to really
I've been having this really annoying thing happen the past few days, that has
I'm really frustrated with this one. A few weeks ago I got it working
Guys I've asked few days ago a question and didn't have really time to
I have a solution with two relevant (to this question) projects, and a few
I have a few questions about creating a database from a model. Is it
Summary I have seen a few questions on std::vector recently, and out of curiosity

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.