Antoon Pardon wrote:

>   def __rmul__(self, num):
>     tp = num * [self]
>     return reduce(operator.add, tp)
> 
> sum3d6 = 3 * D(6)

One basic question: is there any particular reason not to 
use __mul__ instead (that would allow me to use both 3 * 
D(6) and D(6) * 3, while __rmul__ raises an AttributeError 
with the latter)? Difference between the two methods is 
slightly unclear to me.

Thanks,
Tomi Lindberg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to