I'm a fan of infinite sequences. Try out itertools.islice. You should not underestimate this very important module.
Please read also the documentation: https://docs.python.org/3.6/library/itertools.html from itertools import islice iterable = range(10000000000) # since Python 3 range is a lazy evaluated object # using this just as a dummy # if you're using legacy Python (2.x), then use the xrange function for it # or you'll get a memory error max_count = 10 step = 1 for i, element in enumerate(islice(iterable, 0, max_count, step), start=1): print(i, element) Greetings Andre -- https://mail.python.org/mailman/listinfo/python-list