Open KOLANICH opened 4 years ago
Seems to make sense, likely a good idea. Probably requires certain command line switch to activate to these features.
FYI, if Python 2 compatibility is a concern, there are also type comments, which are compatible with both Python 2 and 3.
I don't know if that is relevant for ksc - it depends on how long/much you want to keep support for Python 2. A lot of developers are using only Python 3, all current major Linux distros have moved to Python 3 by default, and libraries have already started dropping Python 2 before its official end of life. Some enterprise environments and existing codebases can be slow to migrate though. (In any case, I'd guess that dropping Python 2 would only happen after 0.9 is released.)
As I have already said, I am using python 3 exclusively from 2013. I mean I used python 2 only on rare occasions when I wanted to merge my patch into an upstream and the upstream strictly required the stuff being working on 2, so I had to use six
and make sure it works on both.
I don't have any strong stakes related to Python, I just wanted to point that this:
all current major Linux distros have moved to Python 3 by default
is not really true:
OK, I should have said "all current Linux distros are moving to Python 3 by default" :) OpenSUSE seems to be a bit slower than Debian, Ubuntu and RHEL, but they have also started moving to Python 3. There's nothing that can be done about old LTS versions of course, those are stuck with whatever Python versions they came with. In any case, Python 3 has been widely available on Linux for a while, even if it wasn't the system default, so it's mostly up to developers and users to choose.
btw, the python
in Debian/Ubuntu is just a naming thing. As I understand it, python
always implicitly refers to Python 2 (e. g. there are packages python-kaitaistruct
and python3-kaitaistruct
, but no python2-kaitaistruct
), and once Debian has finished removing Python 2 packages, only the python3
versions will be left.
Python 3 (2 is EOL) allows to add some type hints. They are not enforced without special measures, but can be used by linters (like
mypy
), REPLs and langservers.import typing
to the top of a file->
before:
: TypeOfArg
right after arg nametyping.Union[T1, T2]
typing.List[T]
, or maybe even more generictyping.Iterable[T]
self
is usually not marked as a type of an arg-> None