Re: Set run vars with each call

2011-07-12 Thread Gnarlodious
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:

Re: Set run vars with each call

2011-07-12 Thread Steven D'Aprano
Gnarlodious wrote: > Question. Is there a special method or easy way to set default values > with each call to an instance? Any ideas to make it easier? What I > want to do is have a constantly updating set of values which can be > overridden. Just thought there was an easy way to set that up. Al

Re: Set run vars with each call

2011-07-12 Thread Ben Finney
Gnarlodious writes: > OK, [the ‘__init__’ method] sets a value at init time. But is there a > similar built-in to run whenever the class instance is called? You can write a ‘__call__’ method which will be called when the instance is called. But I suspect that's still not what you're asking. Ma

Re: Set run vars with each call

2011-07-12 Thread Ian Kelly
On Tue, Jul 12, 2011 at 11:50 AM, Andrew Berg wrote: > On 2011.07.12 12:32 PM, Gnarlodious wrote: >> OK, that sets a value at init time. But is there a similar built-in >> to run whenever the class instance is called? > What do you mean by call an instance? Do you want to run certain code > whenev

Re: Set run vars with each call

2011-07-12 Thread Andrew Berg
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 On 2011.07.12 12:32 PM, Gnarlodious wrote: > OK, that sets a value at init time. But is there a similar built-in > to run whenever the class instance is called? What do you mean by call an instance? Do you want to run certain code whenever any me

Re: Set run vars with each call

2011-07-12 Thread Gnarlodious
On Jul 12, 8:46 am, Alister Ware wrote: > I thought that was the role of the __init__ function > > class Something: >         def __init__(self): >                 self.value="some value" OK, that sets a value at init time. But is there a similar built-in to run whenever the class instance is ca

Re: Set run vars with each call

2011-07-12 Thread Alister Ware
On Tue, 12 Jul 2011 06:32:32 -0700, Gnarlodious wrote: > Question. Is there a special method or easy way to set default values > with each call to an instance? Any ideas to make it easier? What I want > to do is have a constantly updating set of values which can be > overridden. Just thought there

Set run vars with each call

2011-07-12 Thread Gnarlodious
Question. Is there a special method or easy way to set default values with each call to an instance? Any ideas to make it easier? What I want to do is have a constantly updating set of values which can be overridden. Just thought there was an easy way to set that up. -- Gnarlie -- http://mail.pyt