Skip to content

list * integer works but integer * list doesn't work #401

@sagetrac-dmharvey

Description

@sagetrac-dmharvey

In SAGE 2.6, you can do list * integer but not integer * list. Either they should both work (more like python) or neither of them should work (for internal consistency).

sage: [3, 4, 5] * 2
 [3, 4, 5, 3, 4, 5]

sage: 2 * [3, 4, 5]
---------------------------------------------------------------------------
<type 'exceptions.TypeError'>             Traceback (most recent call last)

/home/dmharvey/sage-2.6/<ipython console> in <module>()

/home/dmharvey/sage-2.6/element.pyx in element.RingElement.__mul__()

/home/dmharvey/sage-2.6/element.pyx in element.bin_op_c()

<type 'exceptions.TypeError'>: unsupported operand parent(s) for '*': 'Integer Ring' and '<type 'list'>'

Component: basic arithmetic

Issue created by migration from https://trac.sagemath.org/ticket/401

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions