Multiplying sequences with floats

Dan Sommers me at privacy.net
Thu Mar 23 19:34:41 EST 2006


On Fri, 24 Mar 2006 00:35:44 +0100,
Christoph Zwerschke <cito at online.de> 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.  ;-)

Regards,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist



More information about the Python-list mailing list