Page moved to: Thread Unsafety

#!/usr/bin/env python
import time,itertools
from threading import Thread

class FizzBuzz():
  g_place = ''
  def th(self, t, tminc, fn):
    start = time.clock()
    while True:
      t +=tminc
      while time.clock()<start+t: time.sleep(0.01)
      self.g_place = fn(self.g_place)
    
  def go(self, counter, printer):
    thds = ((0.7, 1.0, lambda c: printer(c)), 
      (0.0, 1.0, lambda c: counter.next()),
      (0.1, 3.0, lambda c: 'Fizz'), 
      (0.2, 5.0, lambda c: 'FizzBuzz' if c=='Fizz' else 'Buzz'))
    for thd in thds: Thread(target=self.th, args=thd).start()

def _print(s): print s
FizzBuzz().go(itertools.count(1), _print)
As far as I know, this is a unique way to code FizzBuzz. It's also a pretty bad way, for a variety of reasons. But at least it's multithreaded!