[Python-3000] Changing behavior of sequence multiplication by negative integer (original) (raw)

Lawrence Oluyede l.oluyede at gmail.com
Thu Aug 10 10:15:10 CEST 2006


I've never seen bugs determined by operations such as:

"foobar" * -1

and to be honest I've never seen code like that because the semantics is somewhat senseless to me but I think the behavior of the expression evaluation of "Sequence * negative integer" should be changed from:

"foobar" * -1 '' ["foobar"] * -1 [] ("foobar") * -1 ''

to something throwing an exception like when you try to multiplicate the sequence by a floating point number:

"foobar" * 1.0 Traceback (most recent call last): File "", line 1, in ? TypeError: can't multiply sequence by non-int

It's not a big deal to me but maybe this can be addressed in the python3000 branch

-- Lawrence http://www.oluyede.org/blog



More information about the Python-3000 mailing list