3 ms·
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
by CJefferson 8y ago
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.
- orf 8y agoIn Python 3 they are two distinct types as well.
- lmm 8y agoThey're not really "types" when you only find out at runtime.
- orf 8y agoSure they are.
- joshuamorton 8y agoWhen 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.