Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a longer docstring
#2
I've been experimenting and you can use parentheses and implicit string concatenation
>>> def func():
...     ("This is the beginning of a very long docstring which must stand on one line"
...     " now the rest of this very long docstring hope it will be allright.")
...     print('Hello from func()')
... 
>>> func()
Hello from func()
>>> func.__doc__
'This is the beginning of a very long docstring which must stand on one line now the rest of this very long docstring hope it will be allright.'
The uncommon part is that usually docstrings have a reasonably sized first line and may have other lines.
Reply


Messages In This Thread
a longer docstring - by Skaperen - Aug-24-2022, 05:05 PM
RE: a longer docstring - by Gribouillis - Aug-24-2022, 05:18 PM
RE: a longer docstring - by Skaperen - Aug-25-2022, 01:15 AM
RE: a longer docstring - by Gribouillis - Aug-25-2022, 08:58 AM
RE: a longer docstring - by perfringo - Aug-25-2022, 01:40 PM
RE: a longer docstring - by Gribouillis - Aug-25-2022, 01:57 PM
RE: a longer docstring - by perfringo - Aug-25-2022, 03:46 PM
RE: a longer docstring - by Gribouillis - Aug-25-2022, 07:14 PM
RE: a longer docstring - by Skaperen - Aug-25-2022, 11:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Beginner: Code not work when longer list raiviscoding 2 887 May-19-2023, 11:19 AM
Last Post: deanhystad
  IDLE editing window no longer works chris1 2 2,286 Feb-06-2021, 07:59 AM
Last Post: chris1
  Code no longer working yk303 14 10,420 Dec-21-2020, 10:58 PM
Last Post: bowlofred
  ReferenceError: weakly-referenced object no longer exists MrBitPythoner 17 11,804 Dec-14-2020, 07:34 PM
Last Post: buran
  calling a method for a docstring Skaperen 8 3,129 Jan-27-2020, 01:16 AM
Last Post: Skaperen
  get docstring to work with another block of text at the top Skaperen 4 2,544 Dec-28-2019, 10:37 PM
Last Post: Skaperen
  My code is taking longer time to give result rajeshwin 4 3,394 Feb-20-2019, 08:18 PM
Last Post: ichabod801
  Catching exceptions in embedded code no longer works on 3.7.2? FFMG 5 3,464 Feb-02-2019, 10:15 AM
Last Post: Larz60+
  ptpython docstring metulburr 4 4,538 Nov-17-2017, 01:36 AM
Last Post: metulburr
  long lines, longer than 72 or 79 Skaperen 1 3,164 Mar-08-2017, 07:56 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020