Multiplying sequences with floats

Dan Sommers me at
Fri Mar 24 01:34:41 CET 2006

On Fri, 24 Mar 2006 00:35:44 +0100,
Christoph Zwerschke <cito at> wrote:

> Currently, if you write 3*'*', you will get '***', but if you write
> 3.0*'*', you will get an error (can't multiply sequence by non-int).

> I was wondering whether this should be allowed, i.e. multiplication of
> a sequence with a float. There could be either an implicit typecast to
> int (i.e. rounding) ...

Explicit is better than implicit.

At least until some future version of python in which math.sqrt( 4.0 )
returns an integer.  ;-)


Dan Sommers
"I wish people would die in alphabetical order." -- My wife, the genealogist

More information about the Python-list mailing list