[Numpy-discussion] How recreated a integer list with a generator?

Mario Moura moura.mario@gmail....
Sat Feb 26 07:41:49 CST 2011


Hi Folks

How recreated a integer list with generator?

import random
tmp = []
for x in range(0,600):
	tmp.append(random.randint(0,5000))

tmp = list(set(tmp))
tmp.sort()

Should be possible recreated this list using same magic math formula
or numpy array?

Can I create a generator? How?

What is my target?

I need store this list im my database, the list itself get big size
(resources) so I want save resources and save the generator object
with pickle.

Is it possible?

What I have:

size = len(tmp)
min = tmp[1]
max = tmp[-1]

All numbers are integer and it is a random serie so each list will
have your own generator.

Again tmp is a static list and must be recreated with a generator the
target is pickle the generator to be smaller than the list itself.

Best Regards

Mario


More information about the NumPy-Discussion mailing list