r/learnpython • • Nov 27 '20

Milestone - 1,000 lines of code - TU r/learnpython!

Hi friends,

Just wanted to tell you all that I reached my first 1,000 lines of Python code (wanted to show a pic, but not allowed). I'm going through the book Python Crash Course, 2nd edition and doing all the exercises and some of the examples. Strongly recommend this resource, as so many others already have done. Also, I want to say a huge thank you to this community! I wouldn't have come this far without you <3

333 Upvotes

49 comments sorted by

View all comments

54

u/potato-sword Nov 27 '20

Congrats! Just a suggestion for the future, try not to measure your learning / success by lines of code written as there is no correlation between the two.

You may find yourself refactoring code to increase reusability which can reduce the number of lines. As well, you may be able to accomplish some tasks in just a couple lines depending on the implementation. For example, using a list comprehension instead of a for loop.

17

u/TheTruthIsOutThur Nov 27 '20

I'm not sure I'd say there's no correlation. Lines of code is a metric of time spent coding, and I definitely would say the more you practice the better you are. Even if these 1000 lines OP is mentioning are garbage, I bet OP is a lot more competent now than before they wrote them.

That said. "Time spent coding" is probably more correlated haha

4

u/potato-sword Nov 27 '20

I agree, writing code is good, and you learn by coding.

But from my own experiences, I've found that during my learning journeys I would reach a point where I realized less is more. By this I mean, I started learning how to write more succinct code, whether it was with syntactic sugaring, reusable components, or implementing libraries. I would often look back at my past spaghetti code, and wonder why I spent hundreds of lines of code to implement something that could be done in less.

Overall, I think there are better ways to measure your learning. I believe creating a learning plan consisting of concrete and measurable goals for yourself can be one way to do this, but mileage may vary.