Hi, noob question but why is the replace function not mentioned in the list of available methods in the docstring of the date class?
Source:
class date:
“”“Concrete date type.
Constructors:
new()
fromtimestamp()
today()
fromordinal()
Operators:
repr, str
eq, le, lt, ge, gt, hash
add, radd, sub (add/radd only with timedelta arg)
Methods:
timetuple()
toordinal()
weekday()
isoweekday(), isocalendar(), isoformat()
ctime()
strftime()
Properties (readonly):
year, month, day
“””
1 Like
It’s probably just an oversight.
I don’t think it is very helpful for the class docstring to waste space
merely listing all of its methods by name. You can get that information
from either dir
or help
.
Unless the docstring is made more useful, e.g. by adding doctests or
similar, I think that the list of methods should be removed. It is a
perfect example of how comments in code become out of date and
inaccurate.
“It’s probably just an oversight. It is a perfect example of how comments in code become out of date and inaccurate.”
Yes, the reason why I posted the question here is to make sure that it is indeed a case of oversight and not because the function has already been documented somewhere else in the code.
The info in the docstring shows up in a pop up when I hover over a class or function in vscode. I don’t know from where vscode is pulling that information from but it can actually be quite useful for beginners like me.
I would also like to do my bit in helping to fix the docs whenever I come across minor issues like this. I just published my first project on github but I am not quite sure how to get started on contributing to an existing project. Could you give me some advice on it? Thanks.