[Python-Dev] RE: [Python-checkins] python/nondist/pepspep-0323.txt, NONE, 1.1 pep-0000.txt, 1.254, 1.255

Raymond Hettinger python at rcn.com
Tue Oct 28 12:09:55 EST 2003


[Alex]
> Btw, random.py doesn't seem to supply pseudo-random iterators --
> easy to make e.g. with iter(random.random, None) [assuming you
> want a nonterminating one],

Probably a bit faster with:

	starmap(random.random, repeat(()))



> but that wouldn't be copyable.  Should
> something be done about that...?

No.

1) The use case is not typical.  Other than random.random() and
time.ctime(), it is rare to see functions of zero arguments that
usefully return an infinite sequence of distinct values.

2) If you need a copy, run it through tee(). 



Raymond




More information about the Python-Dev mailing list