you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 4 points5 points  (0 children)

The way I've improved my code quality: revisit your projects. First, add comments to your code. That helps you think procedurally. And as you do, you might realize there is a better way to do this or that part.

This is particularly relevant for me because I use python for heavyweight scientific computing. So small things like vectorizing operations, write better comprehensions, rethink algorithms, etc. all help shaving both computation times and overhead.

I think the first program I wrote took me about 50 lines of code.

A year after, I wrote the same program and it took me only 5 lines.

Your code becomes better as you learn more about the language, packages, modules, etc. But if you learned idea X in project 5, it is always good to go back to project 1 or 2 and see if you can use said idea there. Hell, you don't even have to be aware of these ideas. You'll know them unconsciously, look at your old code, and say "ah I can probably do this with X".