New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add docstrings to time.struct_time #53145
Comments
The time.struct_time class is missing class and field docstrings: >>> time.struct_time.__doc__ is None
True
>>> time.struct_time.tm_year.__doc__ is None
True This is significant because it is not obvious that field values are different from those of C language struct tm fields with the same names. (While module level docstring describes the timetuple, it does not list the names of the struct_time fields or mentions struct_time.) With the attached patch, >>> from time import *
>>> localtime()
time.struct_time(tm_year=2010, tm_mon=6, tm_mday=4, tm_hour=15, tm_min=27, tm_sec=15, tm_wday=4, tm_yday=155, tm_isdst=1)
>>> help(_)
Help on struct_time object: time.struct_time = class struct_time(__builtin__.object)
| The time value as returned by gmtime(), localtime(), and strptime(), and accepted
| by asctime(), mktime() and strftime(), may be considered as a sequence of 9 integers.
| Note that several fields' values are not the same as those defined by the C language
| standard for struct tm. For example, the value of tm_year is the actual year, not
| year - 1900. See individual fields' descriptions for details.
...
| | Data descriptors defined here: |
Patch review:
|
Please see fixes in bpo-8899.diff.
Fixed.
Fixed.
Fixed in docstrings and time.rst.
Fixed. POSIX spec uses "if the information is not available", but I like
Fixed in docstrings and time.rst. |
The first change in time.rst is not needed; there the sentence is not a direct description of struct_time. The rest is good to commit. |
Committed in r81756 (trunk) and r81757 (py3k). |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: