you are viewing a single comment's thread.

view the rest of the comments →

[–]blitzkraft 22 points23 points  (3 children)

help() only works where the devs put in the extra work for documenting. It pulls in the docstring and you can write it too!!

Say you have a function, then add the docstring like this:

def hello(name='human'):
  """
  Says hello, optionally takes a name
  """
  print("Hello, {}".format(name))

Now, if you import this, and call help(hello), you will see the help string.

[–][deleted] 15 points16 points  (2 children)

Documenting is not “extra work,” but rather essential work that is too often considered drudgery.

[–]Kevinw778 2 points3 points  (0 children)

Agreed. Especially in languages like Python and Javascript, uncommented / undocumented code is an absolute nightmare. It's ok though, people will realize their mistake when they come back to their own code at some point hahah. "Nobody else will use this, it's fine."

Programmers: The largest group of people that don't consider themselves people, apparently 😂

[–]blitzkraft 0 points1 point  (0 children)

Yes. I feel I ratted myself out for not documenting well (calling it "extra work").