General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Immudzen
Continuous Delivery
comments
Comments by "Immudzen" (@Immudzen) on "The World's Most Popular Programming Language" video.
I work with Python extensively for my job. We usually reserve comments to explain why something is done not what is done. Especially for scientific and engineering code it can really help to have a comment on where the math in a function comes from or why the math is there. We also heavily use the Python system and to further improve we often use dataclasses for input and output for functions with more complicated inputs and outputs. This is much better than a dictionary and it works as a contract for the function that other systems can rely on. For scientific and engineering code python fits extremely well because there are so many good libraries for Python to solve these types of problems. The libraries also tend to be highly optimized so you pay very little performance penalty for using Python. I especially love libraries like numba because you can compile Python code under certain circumstances to high performance code.
15
One of the thing you can do is for functions that take a dictionary of arguments or return a dictionary of outputs is to create a dataclass instead. You can then type based on the dataclass and your input and output is then a contract that is far easier to test. You can then also put types on all of the variables involved. It also makes it easier to test and document.
2
Alternatives are difficult because it depends on what you are doing. For example I have never seen someone use Typescript. I have heard of the language but nothing beyond that. All of my work is on science and engineering applications and the alternatives would be things like MATLAB (proprietary) or Julia (still very new and not many people know it). Don't use MATLAB just don't. If you are doing machine learning you have Python and you have rounding errors for usage in other languages.
1
@berkes That has not been my experience. I have been coding Python since version 1.5. All of my work is science and engineering based modeling. We have nearly 100% unit test coverage and have been using type information since it was introduced. The type information doesn't help much with bugs but it is great for helping the IDE and more recently AI assist. There are so many tools for science and engineering code it is hard to justify not using Python because of the lack of libraries for other platforms. The way I see it you are dependent on tests no matter what because a type system won't save you and if you need to test everything then Python doesn't cause more problems than languages like C# does.
1
Sometimes where is also useful. If you are implementing something from a research paper then please put a link to the paper you are implementing it from so that 5 years later when we have to update the model we can find what you based it on.
1
For all of our projects we use conda and create a yaml file to make it easy to create the environments. Especially for science, engineering, machine learning applications this will take care of your dependencies and link to high performance libraries with libraries like numpy linked to openblas or mkl and these provide a large performance increase.
1
@berkes Automated testing is designed to catch issues, if you don't have it you are screwed anyways. I have not had Python become less maintainable over time due to language issues. I have had poor coders make bad code and that becomes less maintainable but I see that in any language. That is something senior developers need to enforce and mentor to fix.
1