[Numpy-discussion] mail.scipy.org update
Hi everyone, While updating the scipy SSL certificates yesterday, it appeared that filesystem of the servers is corrupted (more than likely a hardware failure). The problem is restricted to one volume and impacts only the web services. The mailing list/mailman service works as expected. We're working on restoring all the different non-functional services. Thanks for you patience! -- Didrik ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
Re: [Numpy-discussion] String & unicode arrays vs text loading in python 3
Stephan Hoyer writes: > On Tue, Sep 13, 2016 at 11:05 AM, Lluís Vilanova wrote: > Whenever we repr an array using 'S', we can instead show a unicode in py3. > That > keeps the binary representation, but will always show the expected result > to > users, and it's only a handful of lines added to dump_data(). > If needed, I could easily add a bytes array to make the alternative > explicit > (where py3 would repr the contents as b'foo'). > This would only leave the less-common paths inconsistent across python > versions, > which should not be a problem for most examples/doctests: > * A 'U' array will show u'foo' in py2 and 'foo' in py3. > * The new binary array will show 'foo' in py2 and b'foo' in py3 (that > could > also > be patched on the repr code). > * A 'O' array will not be able to do any meaningful repr conversions. > A more complex alternative (and actually closer to what I'm proposing) is > to > modify numpy in py3 to restrict 'S' to using 8-bit points in a unicode > string. It would have the binary compatibility, while being a unicode > string > in > practice. > I'm afraid these are both also non-starters at this point. NumPy's string > dtype > corresponds to bytes on Python 3, and you can use it to store arbitrary binary > values. Would it really be an improvement to change the repr, if the scalar > value resulting from indexing is still bytes? > The sanest approach is probably a new dtype for one-byte strings. We talked > about this a few years ago, but nobody has implemented it yet: > http://numpy-discussion.scipy.narkive.com/3nqDu3Zk/a-one-byte-string-dtype From the ref manual, 'S' is a "(byte-)string", which (to me) should never have non-printable characters. That's why I'm advocating "S" to be your proposed one-byte strings, while a new "B" dtype is needed for arbitrary binary arrays. This has the added benefit of making docstrings correct on both py2 and py3. But I won't keep pushing for this; I understand the backwards-compatibility issues mentioned before. Maybe "S" should just be deprecated, "s" (as the one-byte strings) and "B" added instead, and all docstrings and tests changed to "s". In any case, after reading the whole thread, it's not clear to me what's the consensus on what the solution should be (Chris's summary is the closest thing to that). Cheers, Lluis ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion
[Numpy-discussion] Swig tests failing on Array2.resize()
On both osx and Linux, I am seeing 3 swig tests failing out of the entire suite. These both call Array2.resize() with 2 (non-self) arguments. Note that the last two are in fact supposed to fail, but not because of a wrong number of arguments, as happens here: == ERROR: testResize0 (__main__.Array2TestCase) Test Array2 resize method, size -- Traceback (most recent call last): File "testArray.py", line 177, in testResize0 self.array2.resize(newRows, newCols) TypeError: resize() takes exactly 2 arguments (3 given) == ERROR: testResizeBad1 (__main__.Array2TestCase) Test Array2 resize method, negative nrows -- Traceback (most recent call last): File "testArray.py", line 188, in testResizeBad1 self.assertRaises(ValueError, self.array2.resize, -5, 5) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 475, in assertRaises callableObj(*args, **kwargs) TypeError: resize() takes exactly 2 arguments (3 given) == ERROR: testResizeBad2 (__main__.Array2TestCase) Test Array2 resize method, negative ncols -- Traceback (most recent call last): File "testArray.py", line 192, in testResizeBad2 self.assertRaises(ValueError, self.array2.resize, 5, -5) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/unittest/case.py", line 475, in assertRaises callableObj(*args, **kwargs) TypeError: resize() takes exactly 2 arguments (3 given) --- This is with python 2.7.x, swig 3.0.10, and numpy 1.11.1 . I note that >> import Array >> help(Array) gives, for Array2.resize, only this signature: *resize*(self, nrows) Is this currently supposed to work, or have I done something clearly wrong? ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion