Just thought I'd share some silly code I made.


Code:
# Taken from the monty python Spam sketch

import thread
from time import sleep
import sys


def first(f):
    f.write("I want to order some spam, bacon and eggs ")
    f.flush()
    sleep(2)



def random(f):
    import random
    while 1:
        words = ["and ", "plus ", "with a bit ", "on ", "of ", "and I dont want ", "and put some ", "and I'd like ", "and also ", "and please put more ", "and not ", "under the ", "on top of ", "WITHOUT ", "and some ", "or maybe the ", "squeezed together with some ", "WITH ", "cause I hate ", "is just good with some "]
        r = random.randrange(0, len(words))
        f.write(words[r])
        f.flush()
        sleep(1)




def orderobjects(f):
    import random
    while 1:
        objects = ["SPAM BACON SPAM", "SPAM EGGS", "SPAM", "SPAM SPAM BACON SPAM SPAM", "BACON SPAM SPAM BACON SPAM SPAM SPAM", "SPAM BACON EGGS SPAM SPAM SPAM", "SPAM BACON SPAM", "EGGS BACON SPAM", "SAUSAGE SPAM"]
        r = random.randrange(0, len(objects))
        f.write(objects[r]+" ")
        f.flush()
        sleep(1)



print
print "Taken from the well known monty-python Spam sketch: "
print


first(sys.stdout)
thread.start_new_thread(random, (sys.stdout,))
sleep(0.5)
thread.start_new_thread(orderobjects, (sys.stdout,))

while 1:
    sleep(1)