[Numpy-discussion] The future of ndarray.diagonal()

Matthew Brett matthew.brett at gmail.com
Wed Jan 7 10:41:07 EST 2015


Hi,

On Sun, Jan 4, 2015 at 4:22 PM, Konrad Hinsen
<konrad.hinsen at fastmail.net> wrote:
> 2) Changes that yield to different results for unmodified legacy code
> should never be allowed.

I think this is a very reasonable rule.

Case in point - I have some fairly old code in
https://github.com/matthew-brett/transforms3d .

I haven't updated this code since 2011.   Now I test it, I get the
following warning:

======================================================================
ERROR: Failure: ValueError (assignment destination is read-only)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/mb312/.virtualenvs/scipy-devel/lib/python2.7/site-packages/nose/loader.py",
line 251, in generate
    for test in g():
  File "/Users/mb312/dev_trees/transforms3d/transforms3d/tests/test_affines.py",
line 74, in test_rand_de_compose
    T, R, Z, S = func(M)
  File "/Users/mb312/dev_trees/transforms3d/transforms3d/affines.py",
line 298, in decompose
    Z[0] *= -1
ValueError: assignment destination is read-only

If I had waited until 1.10 (or whatever) - I would have had to hope
that my tests were good enough to pick this up, otherwise anyone using
this code would be subject to some very strange bugs.

Cheers,

Matthew



More information about the NumPy-Discussion mailing list