Message 80609 - Python tracker (original) (raw)

Nice. Now I know that eee is a least transcendental number. But I can't figure out why inserting this code into your file (and removing some "itertools.") is difficult or unreadable. I maintain a personal library of modules that I don't actually expect Guido to include in the python standard library.

import itertools

def count(offset=0,stride=1): for i in itertools.count(): yield offset+i*stride

this version probably performs faster

def count(offset=0,stride=1): while True: yield offset offset += stride