the-algorithm
the-algorithm copied to clipboard
Improve python code
Here are few changes I want to implement:
- reformat the entire Python code using
isort
andblack
. - add docstrings where missing
- add type hinting using the in-built
typing
module - use faster string methods (depending on the Python version)
- replace
OrderedDict
with regulardict
(depending on the Python version) - more minor optimisations (depending on the Python version)
I can do all this but would need the following data to do that:
- Python version being used
- dependencies and their version
I have already started working on the first 3 and am going to complete that part. Soon, I will begin to optimise the code but would need the info to do so.
cool
You can't know if this works, it can't compile or test
Surely any sane (or at least... well-engineered?) company like Twitter would set up unit tests?
@nobodyindustries I have only done basic changes right now that would work for any python 3 code. Further optimizations depend on the python version being used by Twitter.
Also, I would suggest your read about testing.
Hey @Siddhesh-Agarwal,
First, I'm very grateful that you did open an issue here to discuss before polluting the PR tracker like most people do.
Would it be possible to group the commits by "squashing" them?
This would make the reviewing process easier.
@aloiscochard I seem to be having some problems with my git and am unable to merge the Commits.
- [x] reformat the entire Python code using
isort
andblack
. - [x] add docstrings where missing (done in most places)
- [x] add type hinting using the in-built typing module (used the built-in
Typing
module) - [x] use faster string methods (depending on the Python version)
- [x] replace OrderedDict with regular
dict
(depending on the Python version) - [x] more minor optimisations (depending on the Python version)
- [x] fix typos
I can do some more optimizations if I was given simple information. Is Twitter using python>=3.6
?
My PR can also solve #365 and the Python part of #1451
You can't know if this works, it can't compile or test
You're right.