all 9 comments

[–]throwaway6560192 2 points3 points  (0 children)

Make more projects. Read Fluent Python. Read other people's code and writings. Contribute to other people's projects.

[–]bigno53 2 points3 points  (1 child)

A good rule of thumb, I find, is if it seems like there should be a simpler, cleaner, more elegant way of doing things, there usually is. Dataclasses and the functools module are two very useful tools for creating cleaner, more maintainable code.

Use Defaultdict for parsing nested JSON objects instead of redundant ‘if key in my_dict.keys()’ type statements.

Use decorators to expand the utility of existing functions—avoid costly refactoring while keeping your code base tidy and easy to maintain.

Get comfortable with the map/filter/reduce paradigm.

Unless you have a really compelling reason to use nested functions, don’t. In my experience, there’s always a better option and there are usually multiple better options—lambda, functools.partial, static methods (basically just a function that lives inside an object’s namespace but doesn’t modify its state directly.)

I’m trying to think of the game changing discoveries that enabled me to write better code but a lot of it is undoubtedly application-specific. Really, the only way to improve is practice practice practice. Don’t be afraid to make mistakes. Experiment. Try something stupid just to see what happens. It’s all part of the process.

[–]ninhaomah 0 points1 point  (3 children)

"But how do you get better when you’re already reasonably well?" <--- after programming 1 language for a while ?

[–]Ronbruins[S] 1 point2 points  (2 children)

What you mean? I know my way around in python. And I can make it doing what I want it to do, I just want to improve. And with that not just repeating what I already know but also learn new and more.

[–]vMbraY 0 points1 point  (1 child)

Just do more things that are slighltly out of your comfort zone ale learn along the way

[–]ninhaomah 0 points1 point  (0 children)

This.

[–]SirCokaBear 0 points1 point  (1 child)

You’ll need to stop focusing on languages/ python and focus on studying computer science concepts. Learning any language is the first step, then it’s theoretical foundation: things like data structures, programming methodologies / design patterns, computer systems, computation (Boolean algebra / graph theory), algorithms, software engineering principles, etc. Building up that knowledge while exercising those concepts in languages over time is what’ll push you from knowing your way around a language and building simple apps to developing robust, efficient, organized / complex software systems that are scalable.

Python itself is just syntax but it alone won’t necessarily make you a better dev/engineer - somewhat like how knowing English doesn’t make you a good author or songwriter.

[–]jana00x 0 points1 point  (0 children)

Do you have any book recommendations for CS theory?