Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sagetrac-dmharvey mannequin opened this issue Jul 10, 2007 · 1 comment
Closed

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

sagetrac-dmharvey mannequin opened this issue Jul 10, 2007 · 1 comment

Comments

@sagetrac-dmharvey
Copy link
Mannequin

sagetrac-dmharvey mannequin commented Jul 10, 2007

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

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Aug 24, 2007

comment:1

Work's for me with Sage 2.8.2:

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

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin added this to the sage-2.8.3 milestone Aug 24, 2007
@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Aug 24, 2007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

0 participants