I'm extremely surprised to see `chr` and `ord` in the "You likely don't need these" section, and that the author has "never really found a use for them in [his] code". I guess he's never done any reverse engineering or NLP work?
back
3 comments
I've worked with Unicode and ASCII conversion directly before in Python, and even then I didn't need these two. There is `str.translate` which requires ordinals aka Unicode codepoints integers, which you would use `ord(str)` for. But then there's also `str.maketrans` which does this 'low-level' fiddling for you: https://docs.python.org/3/library/stdtypes.html#str.maketran... . So even then, arguably a prime use case for `ord` and `chr`, I was able to forego them and work a 'level higher'.
I guess the author has never done any (two extremely specific subfields) work? Most people don’t need to convert characters into numbers, there’s nothing overly surprising about that…
... sure.
But most Python programmers don't do reverse engineering or NLP work either.