
Ask HN: How do I make the transition from being a Python beginner? - mfieldhouse
I've learnt all the basics of Python, the data types, functions, classes and iteration.<p>I've started a project to create Breakout using pygame.<p>I'm done with Learn Python the Hard Way and the other basic tutorials and need to know why you make certain things classes, when to create functions, how should the program be designed, how should it flow and so on. Ideally according to best practices.<p>I feel like I have all the pieces of Python but don't know how to start putting them together to make something that works.<p>Any advice?
======
veyron
Build a small project and start working up.

Here's a simple example, and I and some of my compatriots would be willing to
pay for someone to build, maintain, and possibly open-source it:

Build a parser that can read logs in the NASDAQ OUCH 4.1 format
([http://www.nasdaqtrader.com/content/technicalsupport/specifi...](http://www.nasdaqtrader.com/content/technicalsupport/specifications/TradingProducts/ouch4.1.pdf))
and generate compliance logs. One example is OATS format
([http://www.finra.org/Industry/Compliance/MarketTransparency/...](http://www.finra.org/Industry/Compliance/MarketTransparency/OATS/TechnicalSpecifications/)).
I currently use a unmaintainable perl regex-happy monstrosity, and would like
a clean python version with which I could quickly make changes.

The python workflow should be straightforward and this should not require any
esoteric or nonstandard module (but since this is a learning exercise, I won't
spoil it)

~~~
doublesprout
Not to hijack the post, but this sounds like something I'm interested in. If
OP is swamped, would you mind dropping a line? dblsprout@gmail.com

------
diminium
Playing around with projects and making stuff is a good start.

Here's a warning though. Doing a lot of projects will help but be careful in
considering this as a silver bullet. You will probably pick up some bad habits
as well as future stuff people will go crazy over.

I would try to do something that involves working with other people. You'll
probably have a headache, have an awful time at first but it will teach you a
big lesson - how to structure your code in a way that it's more a diplomat
that plays nicely with other people's code rather than a war mine that nobody
wants to touch with a 1000 foot poll! Once you done that, then choose
something in a completely different area (e.g. if you did client-server, try
UI desktop application as an example). It doesn't have to be a big project but
it will teach you how things can be similar and different.

So in short, solo projects then find your way into a team project of some
type.

Just my two cents. Take what's useful and throwaway what you think is bad.

------
aorshan
I'm in exactly the same boat you are. I recently finished one book and am now
mostly finished with LPTHW. I feel like I have some of the basics down but I
don't really know what to do next. It feels like there is this big gap and I
don't know how to cross it.

------
stonemetal
Unfortunately after you get past the basic learn a language stage, it more or
less dries up. There are a couple of books that are polarizing like Design
Patterns, but that is about it. From here on out it is trial and error.

As far as best practices go here is my list:

Automate everything you can.

Keep it coherent.

Rewrite when you find yourself building a house of cards.

When to create a function: anytime something is complicated enough that you
think about it abstractly, anytime you use something more than once.

When to create a class: I haven't really nailed down a logical description for
how or why I would make a class. Anytime you have a conceptual entity you have
a candidate for a class, a player, a socket, a button, a window, a file.

------
mixmastamyk
Dive into Python has several chapters on test driven development, refactoring,
and performance tuning.

I'd also read some of the best books in general development if you haven't
already: [http://www.codinghorror.com/blog/2004/02/recommended-
reading...](http://www.codinghorror.com/blog/2004/02/recommended-reading-for-
developers.html) Also learn about the SDLC. Applies to every language.

Next, dig deep into the source of a large well-maintained projects such as
Django or perhaps pygame. Learn mercurial, and start contributing via
bitbucket, github, etc.

Find the right project and you should get valuable feedback for your efforts.
;)

~~~
belial
There are few books on the list that I don't know of, it's pretty interesting
to know about them... Thanks for sharing that.

Do you know about "Structure and Interpretation of Coputer Programs" ... IT'S
A CLASSIC! <http://mitpress.mit.edu/sicp/>

~~~
mixmastamyk
Yes, yes, another great choice.

(( What kind of maniac downvotes a friendly response? ))

------
vnchr
Cristina (Crista) Videira Lopes started a list of programming or programming-
related tasks like this: [http://tagide.com/blog/2011/06/things-ics-students-
should-do...](http://tagide.com/blog/2011/06/things-ics-students-should-do-
before-graduating/)

I'm in the same boat. On section 28 of LPTHW. Luckily, I am working with a
startup where I hope to cut my teeth helping more with building our product
instead of just being a customer guy. I promise to follow up when I get a
better answer. Feel free to contact me.

------
civilian
+1 for more projects. You also might try refactoring projects you already
have, it's a good learning process.

I found projecteuler.net to be a really good source for tough programming/math
problems. If you want a never-ending supply of puzzles, that's a good place to
go. When I was first learning Python, my classmate & I challenged eachother to
see who could do problems 1-50 first. (It took us about a month-- we were also
working full time and taking night classes. My classmate finished his 50th a
few hours after me.)

------
redstar504
Keep working on real projects and experimenting. Only so much knowledge can
come from reading. You should also try dissecting some open source projects.

------
doublesprout
"don't know how to start putting them together to make something that
works"...try a Github search?

Design patterns is a great next step, but it sounds like you're not quite
there yet. Something intermediate-level like Dive Into Python will give you
more ideas.

I made apps with WxWidgets and Django after learning the basics, but there are
a million directions to go in. They just all involve building things and
learning as you go.

------
chulipuli
for i in range(1, 1000): print "Do a project.\n"

I know this is rather rude, but doing projects is the only way to learn.

Take it from me, someone who wasted a lot of time trying making it click by
study alone.

------
belial
I would recommend you check this online book: <http://htdp.org/>

"How to Design Programs" is a great resource for newcommers and professionals
alike. It's a good revision and a good start.

Enjoy.

