Skip to content
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

"strftime" format documentation is hard to find #98378

Closed
zvory opened this issue Oct 18, 2022 · 0 comments
Closed

"strftime" format documentation is hard to find #98378

zvory opened this issue Oct 18, 2022 · 0 comments
Labels
docs Documentation in the Doc dir

Comments

@zvory
Copy link
Contributor

zvory commented Oct 18, 2022

Documentation

If you're writing python, and you use "go to definition" on date#strftime you get

    def strftime(self, fmt):
        "Format using strftime()."
        return _wrap_strftime(self, fmt, self.timetuple())

Which is not very helpful. _wrap_strftime is pretty incomprehensible so reading that doesn't help.

If you look up strftime on the docs it also doesn't explain the format. If you click the link to see detailed behaviour you get this wall of reference information which doesn't have just a single example that'll tell 99% of engineers of what their format should look like.

I'm going to put up a PR to fix this.

@zvory zvory added the docs Documentation in the Doc dir label Oct 18, 2022
miss-islington pushed a commit that referenced this issue Oct 18, 2022
)

A small example of what a full date and time would look like would help a lot of developers who may not realize that they should investigate `time.h`'s `strftime`, run `man strftime`, or click through a series of docs on the python docs before they get to the actual [definition here](https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes) which still doesn't have an obvious copy-pastable example of "what the heck format does this thing actually expect?".

Automerge-Triggered-By: GH:rhettinger
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 18, 2022
…ythonGH-98379)

A small example of what a full date and time would look like would help a lot of developers who may not realize that they should investigate `time.h`'s `strftime`, run `man strftime`, or click through a series of docs on the python docs before they get to the actual [definition here](https://docs.python.org/3/library/datetime.htmlGH-strftime-and-strptime-format-codes) which still doesn't have an obvious copy-pastable example of "what the heck format does this thing actually expect?".

Automerge-Triggered-By: GH:rhettinger
(cherry picked from commit 6ccca69)

Co-authored-by: Alex Zvorygin <grafetu@gmail.com>
@slateny slateny closed this as completed Oct 20, 2022
AlexWaygood added a commit that referenced this issue Oct 22, 2022
…GH-98379) (#98395)

gh-98378: Add small format string example to strftime comments (GH-98379)

A small example of what a full date and time would look like would help a lot of developers who may not realize that they should investigate `time.h`'s `strftime`, run `man strftime`, or click through a series of docs on the python docs before they get to the actual [definition here](https://docs.python.org/3/library/datetime.htmlGH-strftime-and-strptime-format-codes) which still doesn't have an obvious copy-pastable example of "what the heck format does this thing actually expect?".

Automerge-Triggered-By: GH:rhettinger
(cherry picked from commit 6ccca69)

Co-authored-by: Alex Zvorygin <grafetu@gmail.com>

Co-authored-by: Alex Zvorygin <grafetu@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants