Opened 14 years ago

Closed 13 years ago

# power series are accidentally *mutable* (really dangerous)

Reported by: Owned by: was somebody major sage-duplicate/invalid/wontfix basic arithmetic N/A

### 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.

### comment:1 Changed 13 years ago by lftabera

Report Upstream: → N/A → invalid new → closed

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.4 → sage-duplicate/invalid/wontfix
Note: See TracTickets for help on using tickets.