[New-bugs-announce] [issue33430] Import secrets module in secrets examples

Daniel Chimeno report at bugs.python.org
Sat May 5 04:54:12 EDT 2018


New submission from Daniel Chimeno <daniel at chimeno.me>:

In the secrets module documentation, the examples in `15.3.4. Recipes and best practices` need change things, I think this examples must run after a copy & paste into user terminal.

Options for first example:
1:
````
import string
from secrets import choice
alphabet = string.ascii_letters + string.digits
password = ''.join(choice(alphabet) for i in range(8))
````

2:
```
import string
import secrets
alphabet = string.ascii_letters + string.digits
password = ''.join(secrets.choice(alphabet) for i in range(8))
````

I've looked in the devguide, but I haven't found what's the standard approach here.

First issue here, be nice :)

----------
assignee: docs at python
components: Documentation
messages: 316200
nosy: dchimeno, docs at python
priority: normal
severity: normal
status: open
title: Import secrets module in secrets examples
type: enhancement
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33430>
_______________________________________


More information about the New-bugs-announce mailing list