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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:12:06+00:00 2026-06-06T03:12:06+00:00

It would be helpful to document the (private -> _x) data members of a

  • 0

It would be helpful to document the (private -> _x) data members of
a class in the same way I can say:

struct foo {
  foo* p_a /* Documentation */
  foo ** pp_b /* Documentation */
};

But for Python (arguably we are in a different programming
model here) what is the preferred way of doing it? Implicitly
defining them by references is not going to cut it when I want
to see immediately what this class models.

This would also be useful for direct conversion to UML
diagrams etc..

  • 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-06T03:12:07+00:00Added an answer on June 6, 2026 at 3:12 am

    You’re right, Python is a different programming model. The thing to understand is, in Python, when you see this:

    class Foo(object):
        ...
    

    It’s not really a “class declaration.” It’s more of a “class creation.” At the instant that the interpreter reaches the class.. line, and not before, a class object is created and made ready. And one thing about this class object is that is basically knows nothing about its instances.

    The only time that the class has access to the instances (and data members are usually on the instances) is when it’s actually running through a method. This syntax:

    def bar(self, x):
        ...
    

    is interesting. The explicit first argument is kind of a hint that something different is going on. That’s right: when you write instance.bar(x), what’s really happening is Foo.bar(instance, x).

    Meaning that Foo‘s only chance at getting at the instance is with methods.

    So if you want an explicit class model, your best bet may be to list it out – explicitly – in the __init__ method.

    class Foo(object):
        def __init__(self):
            self._bar = None  # Bar is an important "private" member
            self._baz = None  # As is baz
            self._fizzbuzz = 4  # Of course, you can also provide defaults here
    

    If I’m way off base here, I’d like to be corrected – but this is how I understand Python currently.

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

Sidebar

Related Questions

I'm having trouble creating multiple AS3 classes, I've got my document class but can't
Can somebody explain what this actually means? An example would be really helpful. WS-I:
The exact exception message would be helpful, too. Thanks.
If yes then presentational elements would be helpful in this condition so should we
I'm fairly new to PHP and MongoDB so it would be really helpful if
Have done some research and found some stuff that may be helpful. I would
Would following the table below be the best way of determining the access type
Would it be possible to add a new operator to the String class that
Would you consider it bad practice to store various user data in a database
Is there any Cheat Sheet or Document where I can see all the build-in

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.