Carl Banks <pavlovevide...@gmail.com> writes:
> random.shuffle() is still better when you're iterating through the
> whole list as the OP was doing.

The OP wrote:

    I want to select, 70% random records from a List. I thougth set
    where a good idea so I tested this way: ...

That sounds like 70% of the list, not the whole list.  Note that
in addition to using time proportional to the size of the entire
lsit rather than the size of the sample, shuffle() also messes up
the order of the list.  

Why would shuffle ever be better?  It is designed for a different
purpose.  Using a function called "sample" when you want to sample
should be a no-brainer, and if using shuffle instead is ever
preferable, that should be treated as a misfeature in the "sample"
implementation, and fixed.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to