Raymond Hettinger added the comment:

There isn't really an option to return a generator because it conflicts the 
rest of the module that uses lists elsewhere and that allows state to be saved 
and restored before and after any function call.  One of the design reviewers 
also said that the generator form would harder for students to use.

I left the text in the examples section unchanged because it is still valid 
(showing how to make a cumulative distribution and how to build a fast 
alternative for the special case of small integer weights). Before the 3.6 
release, I expect to expand this section to provide recipes for a MCMC 
application (using choices() with a passed-in CDF) and some other examples 
suggested by the design reviewers.

The optimization hacks in the other patch don't seem worth it.  The current 
code is readable and runs fast (the principal steps are all C functions).

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue18844>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to