Tortoise and hare cycle detection algorithm using iterators in Python
# -*- coding: utf-8 -*-

from __future__ import print_function
from itertools import islice,cycle,chain


def detect_cycle(iterable):

    class animal(object):


Putting classes inside function is usually not all that helpful. Also, the name doesn't really suggest what this class does. 

        '''Holds the iterator and keeps the last value returned by the iterator'''
        def __init__(self,iterable):          
            self.it = iter(iterable)


I'd do something like iter, just because it isn't a really obvious abbreviation

            self.value = next(self.it) #get the first value

        def next(self):
            self.value = next(self.it)
            return self.value

        def __iter__(self):
            return self


    tortoise = animal(iterable)
    hare = animal(islice(iter(iterable),None,None,2))  #two steps at a time


You end up create two iterators from the same iterable. That might be problematic as you can't be sure those two iterators are independent.

    while True:
        if next(tortoise) == next(hare):
            break


You get most of the benefit of iterators when you can use for loops. In this case, I might use a for loop with itertools.izip.

    hare = tortoise #put hare in the place of tortoise
    tortoise = animal(iterable) #start tortoise from the very beginning
    mu = 0
    while True:
        if hare.value == tortoise.value:
            break
        next(hare)
        next(tortoise)
        mu += 1


You do this basic thing three times. You loop through both iterators, until they match. Write a function that takes the two iterators, does that and then returns the count of them.

    lamb = 0
    tortoise_val = tortoise.value #save the value of tortoise as the object is reassigned to hare
    hare = tortoise
    while True:
        next(hare)
        lamb += 1
        if hare.value == tortoise_val: #check AFTER the first step by hare
            break

    print('mu: {}'.format(mu))
    print('lamb: {}'.format(lamb))