Is there any function in Python that provides an infinite series similar to generateSequence in Kotlin?
In Kotlin I can do something like:
generateSequence(1) { it + 1 }.take(5).forEach { println(it) }
Obviously this stops with an integer overflow error but I would like to do something similar in Python.