Ask HN: How do you structure your Python programs?
I've been teaching myself to code for about 6 months now, and am finally starting to see the efforts pay off (I can actually do stuff). I first started learning to code with Python, and then switched to Ruby on Rails for a project I am working on about 3 months ago. The thing that I, as a noob, love most about Rails is the rigid structure that it provides. It totally makes sense to me, and I feel like it keeps my code organized very well.
However, I had an idea for a small coding project the other day, and for a couple of reasons it really made sense to build it on Google App Engine. So...I dove back into Python after several months of being away. It's amazing how much better I understand the fundamentals now, but I'm looking at my code base (<500 lines) and realizing that I have a mess on my hands.
So, my questions is: How do you structure your code in Python? Do you have any recommendations for tutorials or suggested readings? Any quick tips to help me clean up a mess?
Thanks.
7 comments
[ 2.9 ms ] story [ 30.9 ms ] threadhttp://www.python.org/dev/peps/pep-0008/
I'd say take a look at some of the code in the standard library and in some other packages you've used before, then read this:
http://jcalderone.livejournal.com/39794.html
Then just go for it.