Die Suche ergab 2 Treffer

von YKnot
Montag 21. April 2014, 15:16
Forum: Allgemeine Fragen
Thema: Numpy: poly1d mutable oder immutable?
Antworten: 3
Zugriffe: 742

Re: Numpy: poly1d mutable oder immutable?

Ah, danke :) Ich dachte, es wäre "besser", wenn *jede* Operation das gleiche macht, aber dem ist also nicht so.

Schönen Tag noch :)
von YKnot
Montag 21. April 2014, 13:38
Forum: Allgemeine Fragen
Thema: Numpy: poly1d mutable oder immutable?
Antworten: 3
Zugriffe: 742

Numpy: poly1d mutable oder immutable?

Hey :D

Gibt es so etwas wie "half-mutable", weil numpys poly1d arbeitet meiner Meinung so :P

Bsp.:


import numpy as np

a = np.poly1d([1,2,3])
b = a

a[0] = 2

print(a, b, sep='\n')
# 1x^2 + 2x + 2
# 1x^2 + 2x + 2

a += 1

print(a, b, sep='\n')
# 1x^2 + 2x + 3
# 1x^2 + 2x + 2 # IMHO sollte b ...