Python3 and style
adsharma opened this issue · 3 comments
adsharma commented
Had a few questions:
- Namedtuple vs dataclass. After py37, dataclasses offer additional type safety. Any objections to using them?
- Indentation - running it through
black
is fairly common - regex strings need to be raw strings (some of the type checking errors are related to this)
andreas-abel commented
For compatibility with Python 3.6 (the default on Ubuntu 18.04), I will not use dataclasses; typing.NamedTuple also offers type safety.
Regex strings do not need to be raw strings (in particular not if they contain no escape sequences).
adsharma commented
Regex strings do not need to be raw strings (in particular not if they contain no escape sequences).
flake8 is more explicit:
x64_lib.py:241:23: W605 invalid escape sequence '+'
x64_lib.py:241:41: W605 invalid escape sequence '['
x64_lib.py:241:47: W605 invalid escape sequence ']'
adsharma commented
https://pypi.org/project/dataclasses/ have been backported to 3.6 and indentation of 3 spaces is weird.