Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#5769 closed defect (invalid)

power series are accidentally *mutable* (really dangerous)

Reported by: was Owned by: somebody
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: basic arithmetic Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

wstein@sage:~/build/sage-3.4.1.rc2$ ./sage
----------------------------------------------------------------------
| Sage Version 3.4.1.rc2, Release Date: 2009-04-10                   |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
Loading Sage library. Current Mercurial branch is: ref2
sage: R.<t> = ZZ[[]]
sage: f = 1 + 17*t - 4*t^3 + O(t^5)
sage: f[1] = 10
...
IndexError: power series are immutable

Except they are mutable:

sage: f *= 2
sage: f
2 + 34*t - 8*t^3 + O(t^5)

But they shouldn't be! The _imul_ method needs to be deleted.

Change History (2)

comment:1 Changed 13 years ago by lftabera

Report Upstream: N/A
Resolution: invalid
Status: newclosed

The code has nothing to do with mutability.

sage: a= (1,2,3)

a is a tuple, an immutable object

sage: a += a sage: a (1, 2, 3, 1, 2, 3)

sage: R.<t> = ZZ[[]] sage: f = 1 + 17*t - 4*t3 + O(t5) sage: g=f sage: g is f True sage: f+=f sage: f 2 + 34*t - 8*t3 + O(t5) sage: g 1 + 17*t - 4*t3 + O(t5) sage: f is g False

comment:2 Changed 13 years ago by mvngu

Milestone: sage-4.4.4sage-duplicate/invalid/wontfix
Note: See TracTickets for help on using tickets.