This was reported by C Boncelet.
sage: x = PolynomialRing(QQ,'x').gen()
sage: f = Piecewise([[(0,1),1*x^0]])
sage: r = f*2
sage: r = 2*f
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/boncelet/<ipython console> in <module>()
/Users/boncelet/element.pyx in
sage.structure.element.RingElement.__mul__ (sage/structure/element.c:
8545)()
/Users/boncelet/coerce.pyx in
sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/
structure/coerce.c:5338)()
TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and
'<type 'instance'>'
He then suggested simply defining rmul = mul:
sage: f.__rmul__ = f.__mul__
sage: r = f*2
sage: r = 2*f
sage: r
Piecewise defined function with 1 parts, [[(0, 1), 2]]