Re: sampling without replacement

2008-04-18 Thread bearophileHUGS
Alexy>But in Python it's very slow...< I'm the first one to say that CPython is slow, but almost any language is slow if you use such wrong algorithms like you do. There are many ways to solve your problem efficiently, one of such ways, among the simpler ones is to to not modify the original list:

Re: sampling without replacement

2008-04-17 Thread Mensanator
On Apr 17, 2:41 am, Paul Rubin wrote: > braver <[EMAIL PROTECTED]> writes: > > Using an array is natural here as it represents "without replacement" > > -- we take an element by removing it from the array.  But in Python > > it's very slow...  What approaches are there to

Re: sampling without replacement

2008-04-17 Thread Paul Rubin
braver <[EMAIL PROTECTED]> writes: > Using an array is natural here as it represents "without replacement" > -- we take an element by removing it from the array. But in Python > it's very slow... What approaches are there to implement a shrinking > array with random deletions with the magnitude