diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-03-09 03:21:23 +0000 |
---|---|---|
committer | Eric Wieser <wieser.eric@gmail.com> | 2017-03-09 03:21:23 +0000 |
commit | 6f108ae44904026d7da2a1b71abb116284b04960 (patch) | |
tree | 1ffe66e845471485e67bd2a06521ef62d50e2dce /numpy/lib/polynomial.py | |
parent | 811feb63f5074b54694017b9c0ecb66b848036c1 (diff) | |
download | numpy-6f108ae44904026d7da2a1b71abb116284b04960.tar.gz |
DEP: Deprecate copying random properties in __init__
Diffstat (limited to 'numpy/lib/polynomial.py')
-rw-r--r-- | numpy/lib/polynomial.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 9803ce6fb..50e6d8db2 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -1066,8 +1066,15 @@ class poly1d(object): def __init__(self, c_or_r, r=False, variable=None): if isinstance(c_or_r, poly1d): - for key in c_or_r.__dict__.keys(): - self.__dict__[key] = c_or_r.__dict__[key] + self._variable = c_or_r._variable + self._coeffs = c_or_r._coeffs + + if set(c_or_r.__dict__) - set(self.__dict__): + msg = ("In the future extra properties will not be copied " + "across when constructing one poly1d from another") + warnings.warn(msg, FutureWarning, stacklevel=2) + self.__dict__.update(c_or_r.__dict__) + if variable is not None: self._variable = variable return |