Re:NumPy 1.16 is the last release to support Python 2.7
by ric2b on Monday January 21, 2019 @06:28AM
(#18959598)
> I found code all over the place which broke for unicode reasons (we were reading in the output of GCC, and printing it back out, and it didn't work any more as GCC doesn't output valid UTF8 in some cases).
That means the code was working with raw bytes, not utf-8 strings, so that's what you should convert to on Python3.
That means using `.encode()` and `.decode()` or using bytestrings.
Python3 doesn't break string usage, it makes you do it correctly. Expect a lot more of that kind of pain by moving to Rust (not saying it's not worth, you'll indeed get more correct programs done).
Re:NumPy 1.16 is the last release to support Python 2.7
by CJefferson on Monday January 21, 2019 @06:48AM
(#18959690)
The problem I had with python is that (because it is dynamically typed), and quite a few methods take both bytes and strings, it can be tricky to track what you have and often things don't break until you feed in a non-UTF8 string.
I found it much easier in Rust, as the two types are just distinct, and an incorrect program just fails to compile.
Re:NumPy 1.16 is the last release to support Python 2.7
by orf on Monday January 21, 2019 @09:44AM
(#18960659)
In Python 3 they are two distinct types as well.
Re:NumPy 1.16 is the last release to support Python 2.7
by lmm on Monday January 21, 2019 @11:04AM
(#18961212)
They're not really "types" when you only find out at runtime.
Re:NumPy 1.16 is the last release to support Python 2.7
by joshuamorton on Monday January 21, 2019 @03:11PM
(#18963204)
When handling tricky string issues, my first step is usually to explicitly type annotate the code (using mypy annotations). This makes string handling and tracking much simpler.
In the end I decided moving to Rust was less work than Python 3 (in terms of being sure my program was reliable and wouldn't error out with unicode errors).