[New-bugs-announce] [issue25490] small mistake in example for random.choice()

Anton Tagunov report at bugs.python.org
Tue Oct 27 09:52:10 EDT 2015


New submission from Anton Tagunov:

Invalid example at this page: https://docs.python.org/3.6/library/random.html

'.items()' is missed in the line below:

>>> population = [val for val, cnt in weighted_choices for i in range(cnt)]


The correct variant:

>>> population = [val for val, cnt in weighted_choices.items() for i in range(cnt)]

----------
assignee: docs at python
components: Documentation
messages: 253537
nosy: Anton Tagunov, docs at python
priority: normal
severity: normal
status: open
title: small mistake in example for random.choice()
versions: Python 3.5, Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25490>
_______________________________________


More information about the New-bugs-announce mailing list