Re: to be pythonic: should caller or callee log?

2013-09-06 Thread Gildor Oronar
El 04/09/13 20:14, Xaxa Urtiz escribió: and what about something like that : class AbsctractAccount(): def transaction(self, amount, target): logging.info("Start transaction of %s to %s" % (amount, target)) self.DoTransaction(amount,target) def DoTransaction(sel

Re: to be pythonic: should caller or callee log?

2013-09-04 Thread Gildor Oronar
Thanks: El 04/09/13 05:01, Terry Reedy escribió: I would expect that every account class has a transaction method. * If so, just call it, but assertIsNot(DebitAccount.transaction, AbstractAccount.transaction) for every subclass in your test suite. * If not, perhaps you need an abstract subclass

Re: to be pythonic: should caller or callee log?

2013-09-04 Thread Gildor Oronar
El 04/09/13 10:26, Ethan Furman escribió: I would say it is not really the caller's or the callee's job to do the logging, even though it should be done. What would be really handy is a function that sat in between the caller and callee that logged for you -- you know, a decorator: Thanks a l

to be pythonic: should caller or callee log?

2013-09-03 Thread Gildor Oronar
What would you choose? Do you put logging routine into caller or callee? My intuitive answer is "callee does the logging, because that's where action takes place", like this: class Account(): def transaction(self, amount, target): logging.info("Start transaction of %s to %s" % (amou

what thread-synch mech to use for clean exit from a thread

2013-07-14 Thread Gildor Oronar
A currency exchange thread updates exchange rate once a minute. If the thread faield to update currency rate for 5 hours, it should inform main() for a clean exit. This has to be done gracefully, because main() could be doing something delicate. I, a newbie, read all the thread sync tool, and