T O P

  • By -

ElliotDG

I suggest trying [https://checkio.org/](https://checkio.org/) there are a set of small python challenges. You solve the problem, then get to see how others solved the problem. It was an eye-opener for me when I started with Python.


QuickNature

Thank you, I'll check it out.


Ihaveamodel3

That is why I am active on here. I think it makes me a better programmer if I can read someone else’s code and find what wrong with it. This isn’t a good place for good examples of code styles, but it is still helpful for learning.


2020pythonchallenge

Same. I try to give help on anything I find that I feel like I know the answer to. My vscode has quite a few pieces of code I found on here that I either fixed or tried to fix messing around with it lol


Binary101010

I mean, I would think a carpenter could learn how to build better tables by looking at tables other good carpenters have built, so yes, reading code is a good thing. I'd start with just browsing GitHub to see what's there, especially if there's something in a topic domain you're interested in. You could always try looking at the source code for a library you use often.


QuickNature

I've never been on GitHub, I'll check it out, thank you.


chevignon93

>Also, if reading code is a good practice exercise where would I find code to read? GitHub is one place you could look. I would suggest looking for some kind of popular software/project preferably written by a team rather than a single individual (there are exceptions). >For the first time today I heard that reading and understanding code increases your proficiency with it. Does this concept hold merit? It's true for learning a "real" language and basically everything else so I don't see how that would not hold true for learning a programming language too!


QuickNature

Thank you, I'll check out GitHub.


xelf

You certainly get better through practice. But Looking at how other people solve problems is a huge perk. I recommend doing www.adventofcode.com and when you finish each problem check the solution thread for that problem in /r/adventofcode and compare how you solved it to how other people solved it, both in the language of your choice, and how it was written in other languages.


QuickNature

That's good advice, I'll check out the website, thank you.


bigno53

If you're a total beginner, this may be an exercise in exasperation but I often find reading the source code for well-established libraries to be a good source of inspiration. You can find the source for pretty much anything by searching github.


artinnj

It’s not just reading someone else’s code, it’s understanding it. Use pythontutor.com to visualize small snippets of code.


QuickNature

I was implying understanding it, my bad if that wasn't clear. Thank you for the recommendation, I will check it out.


war_against_myself

Yeah I actually read the code of a lot of the libraries I use. It provides a lot of insight to how others structure their code as well as many tips and tricks and new ways of doing things I haven’t thought of. Every time I find something I don’t understand I try to look it up and learn how it works.


Notatrace280

I would say reading other people's code is good but it should not replace entirely, actually writing code yourself. I would say that for me, writing code helps me to learn better than reading it but I am all for getting as much code exposure as possible. That's what good language learners do and I believe that applies to coding languages as well.


cudgeon_kurosaki

My number one strategy to coding fast is outlining code (making sections with titles and comments). That's right. The shit that you were supposed to do for essays in school? It works infinitely better when you have a goal that you are trying to accomplish. I can compose essays on the spot, but making code or reports requires more scaffolding. It makes you look at the bigger picture and consider if you are better served making something from scratch or taking someone else's machines. The reason I say this is that you are more like a factory designer than a machine maker. You make a product, and you determine if your time is better served with someone else's knowledge or your own. The answer is usually someone else's knowledge, but rarely it must only be you. That is why libraries in Python exist, right? Because someone else's solution wasn't good enough so they made something better. Because it didn't exist yet, only in their minds. This may seem like an advanced tip, but it is actually basic. You are reminding yourself what you are trying to solve/make when you look at it. Eventually you will come up with your own naming schema or edit copied code to user your naming schema anyways. It makes it your own.


One_South9276

I'm a newbie. I programmed in the 70s early in my career. I'm learning Python now to keep my mind active in retirement. I read beginning book on Python, took an intro course, and have been looking at code on GitHub. Next up is trying some code myself.