On Oct 8, 2014, at 9:57 PM, Gregory Ewing <greg.ew...@canterbury.ac.nz> wrote:

> Seymore4Head wrote:
>> I want to toggle between color="Red" and color="Blue"


Don’t forget polymorphic dispatch…

class Red(object):
    def toggle(self):
        return Blue()

class Blue(object):
    def toggle(self):
        return Red()


Blue().toggle().toggle().toggle().toggle().toggle() :)

--
Travis Griggs
Objologist
"Some of them wanted to sell me snake oil and I'm not necessarily going to 
dismiss all of these, as I have never found a rusty snake." --Terry Pratchett

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to