This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Type-specific documentation for __format__ methods
Type: Stage:
Components: Documentation Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: cheryl.sabella, docs@python, eric.smith, skip.montanaro
Priority: normal Keywords:

Created on 2015-06-09 13:38 by skip.montanaro, last changed 2022-04-11 14:58 by admin.

Messages (1)
msg245063 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2015-06-09 13:38
I am only now just prying my fingers off printf-style string
formatting. The new syntax always seemed Perl-like to me, so I ignored
it. Finally, yesterday, I got some cheat sheet pointers from
comp.lang.python and dove in.

I hit a minor roadblock when I couldn't find any type-specific
documentation for the various __format__ methods. In the documentation
on the format() builtin
(https://docs.python.org/3.5/library/functions.html#format) I read,
"The interpretation of format_spec will depend on the type of the
value argument..." which led me to believe I would find something
about (for example) float.__format__ in the section on floats
(https://docs.python.org/3.5/library/stdtypes.html#typesnumeric).

I realize now that the documentation for many formats is in the string
documentation
(https://docs.python.org/3.5/library/string.html#formatspec), but I
think it would still be useful to have at least stubs in the
documentation for the __format__ method of the various builtin types,
even if all those stubs to is refer the reader to the string
documentation.

I started to work on a patch, but I quickly got myself confused about
where to describe <sometype>.__format__. Perhaps it's time that
stdtypes.rst is broken into multiple files, with the structure of the
documentation for the various builtin types made more uniform. For
instance, int and float have sections describing methods, while list,
tuple, set, and dict don't.
History
Date User Action Args
2022-04-11 14:58:17adminsetgithub: 68605
2019-04-13 23:26:34cheryl.sabellasetnosy: + cheryl.sabella
2015-06-09 14:33:23eric.smithsetnosy: + eric.smith
2015-06-09 13:38:05skip.montanarocreate