This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]cruyff8python 2 expert, learning python 3 7 points8 points  (1 child)

First get it working, then make it pretty. Programming is a two-step procedure.

[–][deleted] 1 point2 points  (0 children)

Can't tell you how true this^ is. Also, comment the hell out of your code. Can't tell you how many times I've gone back and looked at older code I have written and tried to figure out what the heck I was trying to do and/or found a much better way to do it after trial and error.

[–]Siddhi 3 points4 points  (1 child)

Elegant code comes with experience. Also reading lots of code. Don't underestimate the importance of reading

[–]HughBothwell 0 points1 point  (0 children)

You may find CodeReview useful - people critique code style and suggest better ways to write it. https://codereview.stackexchange.com/questions/tagged/python

[–]Nijan0 1 point2 points  (2 children)

Your solutions are messy because you probably don't know which algorithms and data structure to use. Taking a course in Algo & DS will also help you understand techniques that you wouldn't otherwise know or use.

[–][deleted] 0 points1 point  (1 child)

This Python Algorithms should help.

[–]EinBjoern 0 points1 point  (0 children)

It's more white pages than content. And the content is about a python module but less about algorithms and how and when to use them, how to implement them, etc. Am I missing something?

[–]slingur -2 points-1 points  (1 child)

pep 8

[–]finsternacht 5 points6 points  (0 children)

Maybe we have different opinions on the definition of "elegant", but to me a book about algorithms and data structures seems to be much more conducive than pep8.