Set run vars with each call

Gnarlodious gnarlodious at gmail.com
Wed Jul 13 04:01:50 CEST 2011


On Jul 12, 6:44 pm, Steven D'Aprano wrote:

> All the words are in English, but the sentences make no sense :)
LOL, impressive powers of mind-reading! Exactly what I needed:

import time
class Event:
    epoch=time.time()
    def doSomething(self, epoch=None):
        if epoch is None:
            epoch = self.epoch
        print(epoch)

e = Event()
e.doSomething()
e.doSomething(123456789)
e.epoch = 1310522110.404471
e.doSomething()

Thanks for the help!

-- Gnarlie
http://Gnarlodious.com



More information about the Python-list mailing list