Python Forum

Full Version: find repeating cycle in iterable results
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have an iterable object (not just an iterator). it has a repeating cycle in it, or not. it comes to an end if not. it repeats forever if so. it would be impossible to determine if the cycle is found if other cycles can repeat a finite number of times since it would be possible for that number to be arbitrarily large. so a rule could be established for a maximum number of repeats that would be the maximum that means "infinite".

i would like to find a module or class or code or something that can find what is specified as the maximum number of repeating cycles. would i need to specify the maximum cycle length, too?

this iterable can yield any kind of object which may be unhashable.