Trying to use sets for random selection, but the pop() method returns items in order
pavlovevidence at gmail.com
Wed Jul 1 22:17:56 EDT 2009
On Jul 1, 7:02 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Carl Banks <pavlovevide... at 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: ...
I was going by his example which went through all the items in the
> 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?
Because we were talking about different things.
More information about the Python-list