Skip to content

gh-94584: Clarify tomllib docs #94585

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

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions Doc/library/tomllib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ This module defines the following functions:

.. function:: load(fp, /, *, parse_float=float)

Read a TOML file. The first argument should be a readable and binary file object.
Return a :class:`dict`. Convert TOML types to Python using this
:ref:`conversion table <toml-to-py-table>`.
Deserialize TOML data from a file-like object, converting TOML types to
Python using this :ref:`conversion table <toml-to-py-table>`. The first
argument should be a readable binary file-like object. Returns a
:class:`dict`.


*parse_float* will be called with the string of every TOML
float to be decoded. By default, this is equivalent to ``float(num_str)``.
Expand All @@ -51,9 +53,10 @@ This module defines the following functions:

.. function:: loads(s, /, *, parse_float=float)

Load TOML from a :class:`str` object. Return a :class:`dict`. Convert TOML
types to Python using this :ref:`conversion table <toml-to-py-table>`. The
*parse_float* argument has the same meaning as in :func:`load`.
Deserialize TOML data from a :class:`str` object, converting TOML types to
Python using this :ref:`conversion table <toml-to-py-table>`. Returns a
:class:`dict`. The *parse_float* argument has the same meaning as in
:func:`load`.

A :exc:`TOMLDecodeError` will be raised on an invalid TOML document.

Expand Down