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:
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
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
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
-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
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
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
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