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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:58:40+00:00 2026-06-01T11:58:40+00:00

Via Function: myfunc Parameters: a – First parameter b – First parameter I can

  • 0

Via

"""
  Function: myfunc
  Parameters:
    a - First parameter
    b - First parameter
"""

I can document a function and it gets listed in the class summary.
How can I do something similar with attributes?
Since I don’t declare them in python I was hoping something like

""" ----------------------------------------------------------------------------
  Attributes:
  first - First attribute of the class
  second - Second one
"""

That is not working at all…

  • 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-01T11:58:41+00:00Added an answer on June 1, 2026 at 11:58 am

    If you don’t declare class attributes explictly – I assume you just assign them values in the constructor – you can put their comments together with the class comment:

    """
      Class: MyClass
      Describe the class here.
    
      Attributes:
        attr1 - First attribute of the class
        attr2 - Second one
    """
    class MyClass:
    
        def __init__(self, arg1):
            self.attr1 = arg1
            self.attr2 = "attr2"
    

    You can do the same for methods too. It is the simplest way but you won’t get the class members listed separately in the index, which is a huge drawback. If you provide a prefix for every class member references in the documentation will work:

    """
      Class: MyClass
      Describe the class here.
    
      Attribute: attr1
      First attribute of the class
    
      Attribute: attr2
      Second one
    """
    class MyClass:
    
        # Constructor: __init__
        # Describe the constructor.
        #
        # Parameters:
        #   arg1 - The first argument.
        def __init__(self, arg1):
            self.attr1 = arg1
            self.attr2 = "attr2"
    
        # Method: method1
        # Describe the method here.
        def method1(self):
            print("method1")
    

    Prefixing the comment is not a problem for methods where the comment is usually put just before the implementation anyway. If you don’t declare your attributes explicitly to make natural place for their comment, it will clutter the class comment a little. You could also split the comment to more parts. Notice that you can mix line and block comments.

    Two remarks: If you want to use block comments delimited by """ and not just the line comments prefixed by # you have to add the following lines to Languages.txt in the NaturalDocs project directory:

    Alter Language: Python
    
       Block Comment: """ """
    

    Apparently you like the keyword Attribute instead of Property which is recognized by NaturalDocs by default. Add the following to Topics.txt in the NaturalDocs project directory to have it recognized too:

    Alter Topic Type: Property
    
       Add Keywords:
          attribute, attributes
    

    — Ferda

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

Sidebar

Related Questions

Is there any way that I can call a JavaScript function via css? For
I'm using a Class Library exporting a function via COM. When calling this function
In user mode IOCTL calls can be made via DeviceIoControl function. What can I
How can I change the value of a variable via a function that consumes
I've got a C# class with a Dispose function via IDisposable . It's intended
I'm working on a class which needs to be accessible via static function calls
How can I generate the image source via a JavaScript function? I am using
I'm attempting to pass an std::function via a method like so: class dispatch {
I added markers onto my map via this function. markers : an array of
I am extracting content selected by the user via this function: function getSelectionHTML() {

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.