Skip to content

Commit 5bba7e4

Browse files
kovanclaude
andcommitted
gh-143700: Document secrets.DEFAULT_ENTROPY
Add documentation for the DEFAULT_ENTROPY constant in the secrets module. Document it as an opaque value that may change at any time, encouraging users to explicitly pass nbytes if they need a specific amount of entropy. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7e2c9bd commit 5bba7e4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Doc/library/secrets.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ The :mod:`secrets` module provides functions for generating secure
6262
tokens, suitable for applications such as password resets,
6363
hard-to-guess URLs, and similar.
6464

65+
.. data:: DEFAULT_ENTROPY
66+
67+
The default number of bytes of randomness used by the ``token_*``
68+
functions when *nbytes* is not specified. This is an opaque value
69+
that may change at any time, including during maintenance releases.
70+
Users who need a specific amount of entropy should explicitly pass
71+
the *nbytes* argument.
72+
6573
.. function:: token_bytes([nbytes=None])
6674

6775
Return a random byte string containing *nbytes* number of bytes.

0 commit comments

Comments
 (0)