
Dec. 25, 2012
9:43 a.m.
On 25/12/2012 7:23am, Andrew Grigorev wrote:
class Factorial: def __init__(self, n): self.n = n def calculate(self): return factorial(n) def __str__(self): return str(self.calculate)
logging.debug("Factorial of %d is %s", 2**15, Factorial(2**15))
A more generic alternative would be class str_partial(functools.partial): def __str__(self): return str(self()) logging.debug("Factorial of %d is %s", 2**15, str_partial(factorial, 2**15))) -- Richard