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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:47:52+00:00 2026-05-30T06:47:52+00:00

I’m adding some ( epydoc ) documentation to a package I’ve written, and I’m

  • 0

I’m adding some (epydoc) documentation to a package I’ve written, and I’m coming across a lot of instances where I’m repeating myself a multitude of times.

def script_running(self, script):
    """Return if script is running

    @param script: Script to check whether running

    @return: B{True} if script is running, B{False} otherwise
    @rtype: C{bool}
    """

PEP257 says that:

One-liners are for really obvious cases.

and also

The docstring for a function or method should summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable).


Is there a general guideline or standard practice for when to draw the line between a one-liner (description) and full param/return fields?

Or when generating documentation should I include every applicable field for each function, regardless of how repetitive it seems?

Bonus question: Syntactically, what’s the best way to describe the script param?

  • 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-30T06:47:53+00:00Added an answer on May 30, 2026 at 6:47 am

    The general guideline you are looking for is right in PEP257 in what you quoted, maybe you just need to see it in action.

    Your function is a good candidate for a one-line docstring ("really obvious cases"):

    def script_running(self, script):
        """Check if the script is running."""
    

    Usually if you say that a function is checking something it means that it’s going to return True or False, but if you like you could be more specific:

    def script_running(self, script):
        """Return True if the script is running, False otherwise."""
    

    Once again all in one line.

    I would probably also change the name of your function, because there’s no need to emphasize on what the function works in its name (a script). A function name should be something sweet, short and meaningful about what the function does. Probably I’d go with:

    def check_running(self, script):
        """Return True if the script is running, False otherwise."""
    

    Sometimes the function-name-imagination is tired by all the coding, but you should try anyway to do your best.

    For a multiline example, let me borrow a docstring from the google guidelines:

    def fetch_bigtable_rows(big_table, keys, other_silly_variable=None):
        """Fetches rows from a Bigtable.
    
        Retrieves rows pertaining to the given keys from the Table instance
        represented by big_table.  Silly things may happen if
        other_silly_variable is not None.
    
        Args:
            big_table: An open Bigtable Table instance.
            keys: A sequence of strings representing the key of each table row
                to fetch.
            other_silly_variable: Another optional variable, that has a much
                longer name than the other args, and which does nothing.
    
        Returns:
            A dict mapping keys to the corresponding table row data
            fetched. Each row is represented as a tuple of strings. For
            example:
    
            {'Serak': ('Rigel VII', 'Preparer'),
             'Zim': ('Irk', 'Invader'),
             'Lrrr': ('Omicron Persei 8', 'Emperor')}
    
            If a key from the keys argument is missing from the dictionary,
            then that row was not found in the table.
    
        Raises:
            IOError: An error occurred accessing the bigtable.Table object.
        """
    

    This could be one way to "summarize its behavior and document its arguments, return value(s), side effects, exceptions raised, and restrictions on when it can be called (all if applicable)".

    You might also be interested to look at this example of pypi project that it’s meant to be documented with Sphinx.

    My 2 cents: Guidelines are meant to give you an idea about what you should and shouldn’t do, but they are not strict rules that you have to blindly follow. So at the end choose what you feel to be better.


    I would like to clear something that is been said in another answer about hitting the Maximum Line Length with a docstring.

    PEP8 tells you to "Limit all lines to a maximum of 79 characters" even though at the end everyone does 80.

    This are 80 characters:

    --------------------------------------------------------------------------------
    

    And this may be an edge case where a little long one sentence is all you really need:

    def my_long_doc_function(arg1, arg2):
        """This docstring is long, it's a little looonger than the 80 characters
        limit.
        
        """
    

    Is like a one-line docstring, meaning that is for really obvious cases, but on your editor (with the 80 character limit) is on multiple lines.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is

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.