Skip to content

Instantly share code, notes, and snippets.

@barraponto
Forked from pmarkun/gist:7138789
Last active December 26, 2015 10:59
Show Gist options
  • Save barraponto/7140704 to your computer and use it in GitHub Desktop.
Save barraponto/7140704 to your computer and use it in GitHub Desktop.
from time import sleep
from os import linesep as delimiter
from twisted.internet import stdio
from twisted.protocols import basic
from twisted.internet import reactor
class WakeUpCall(basic.LineReceiver):
def connectionMade(self):
self.transport.write('Up?')
def lineReceived(self, line):
self.sendLine('Let\'s Party!')
class Party:
def __init__(self, name, people):
self.name = name
self.all_night = True
self.people = people
people = ["Capi", "Mobi", "Pedro", "Marcela", "Gabi", "Carla"]
party = Party("Python com Pimenta", people)
if "Marcela" in party.people:
sleep(10) # Dorme ae :D
stdio.StandardIO(WakeUpCall()) # Mas bota um despertador
reactor.run() # E dorme assíncrono!
while party.all_night:
print "All night party!!!" # Estamos te esperando!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment