Send a message THROUGH TIME in Python

Who says time travel isn't possible?

import time
 
def send_to_future(message, seconds):
    time.sleep(seconds)
    return message

I'll leave it up to someone else to write the send_to_past() function.

 

 

5 Comments

  1. ferringb wrote,

    Should've used deferreds… they fit the joke better ;)

  2. Juho Vepsäläinen wrote,

    Perhaps something along

    import time
     
    def send_to_past(message, seconds):
        print message
        time.sleep(seconds):
        print 'Sent message to the past."
    

    would do the trick. (Based on the idea that this moment is the past of the future.)

  3. Marius Gedminas wrote,

    Easy: just pass a negative number for seconds.

  4. farmerjoe wrote,

    For your send to past function, I suggest resetting the system clock to an earlier time.
    Something on the order of

    import time, os
    def send_to_past(message, seconds):
     
        t1 = time.time()
        os.system( 'date %s' % asctime(t1-seconds)) 
        return message

    You can verify it works by:

    print 'sending message at time', time.asctime()
    m2 = send_to_past("Posting this message")
    print 'received message at time', time.asctime()
    print m2
  5. Coder19 wrote,

    Even had I wanted to, I could not do it. ,

Leave a comment