Not found in the documentation

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Mon Apr 26 23:48:11 EDT 2021


On 2021-04-26 at 18:24:18 -0700,
elas tica <elasstiika at gmail.com> wrote:

> [...] I was expecting to find [a description of what str returns for
> various types] in the Built-in Types section from the PSL
> documentation. The representation returned by str over a complex
> number is not stated. The same for fraction objects [...]

Assuming that PSL is the Python Standard Library,
https://docs.python.org/3/library/functions.html#func-str says:

    [...] str(object) returns object.__str__(), which is the “informal”
    or nicely printable string representation of object [...]

IMO, an exhaustive list of exactly what that means for every type, even
the built in types, is unnecessary, and could create maintenance or
compatibility issues.

Is there a reason you need that information?  What would you do with it
if you had it?  Completely speculatively on my part, would repr
(https://docs.python.org/3/library/functions.html#repr) meet your
need(s) better than str?


More information about the Python-list mailing list