Python Forum
How do classes work? (rectangle)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do classes work? (rectangle)
#5
In addition to what buran recommends, I would say document, document, document. Add a docstring to the class and each method:

class Dummy(object):
   """This is the docstring for the class."""
   
   def foo(self, bar):
      """This is the docstring for the foo method."""
In the docstring you put a description of the class or what the method does. You can also put in a list of methods and attributes for the class, or a list of parameters for a method. Docstrings help explain your code to other programmers (including yourself in six months) and are available with help(Class) or help(Class.method) in the interactive console.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
How do classes work? (rectangle) - by GFreenD - Sep-17-2019, 03:41 PM
RE: How do classes work? (rectangle) - by GFreenD - Sep-18-2019, 07:38 PM
RE: How do classes work? (rectangle) - by buran - Sep-18-2019, 07:56 PM
RE: How do classes work? (rectangle) - by ichabod801 - Sep-18-2019, 09:50 PM
RE: How do classes work? (rectangle) - by GFreenD - Sep-19-2019, 05:44 AM

Forum Jump:

User Panel Messages

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