I’m trying to learn python and I need good examples of python code to study. My only real requirement is that the source code be well commented so I can know what’s going on internally.
You have seen the official documentation, right?
Yes but it doesn’t show real life uses of why I’d wanted to use certain functions. It tells me what they do, the syntax, but not actual uses for it.
what about sourceforge? Lots of good open source things there including python coded stuff.
Thanks. It had something along the lines I was looking for.
How experienced are you as a programmer in the overall scheme of things? I am a senior analyst and a development manager but I don’t work on anything similar to Python but I wanted to learn. I just bought a book, downloaded a compiler and tried it. It was completely foreign to me but damn that language is powerful. I built a rudimentary web search engine in less than 30 lines that probably could have taken 100 times that or more in some other language. They were 30 difficult lines but it made sense and I just worked towards an arbitrary goal that I made up. I think that is the best way to learn any computer language at least for me and you can get real results right away and learn with it.
I just started teaching myself Python as well, and found dive into python which is free and includes example code. Only on the third chapter, so not sure how useful it is yet.
I’m not an experienced programmer at all. So what you’re saying is I should figure something I want to make with python and then work towards that goal?
It depends on your personality but that is what I and others often do and it works. After all, if you want to learn to use a fancy saw, you don’t just sit there and read the manual. You pick a very simple furniture plan (maybe very, very simple) that you could actually use and figure out how to create it with your new tool. Get more complex as you build skills and want to do more. That philosophy has served me quite well in programming languages as both a hobbyist and a high-level IT professional.
Yes. If nothing else, you’ll have a pretty clear idea of whether you’ve learned the language–after all, if you can get a moderately complex piece of software up and running, you must know something.
I find that the Gale-Shapley algorithm for the stable marriage problem is an excellent non-trivial piece of code, so you should look into that.
I wouldn’t even know how to implement that.
You obviously have an interest in learning Python. Why do you want to learn it? What are your goals?
I thought it was an excellent language to experiment with. It distills complex topics and combines them with some very powerful functions. Just pick something you might think is moderately cool, research how to do it, and then do it. That could be a very simple search function for a single website or a novel solution to a known math problem. The first one might take you a week no matter how simple it is but that is the way to learn programming languages.
I co-manage about 40 developers state-side and in India. When they want to learn something, I just give them a simple (non-critical) problem and tell them to figure it out. About half do and half don’t. It is rarely about intellect. It is almost always about curiosity and there aren’t any true deadlines or single right answers. The most important skill good developers have is curiosity and a desire to learn.
I have very little knowledge of circuit boards but, if I really wanted to know about them at the age of 35, I would just look up some simple projects on-line and march down to Radio Shack to pick up some cheap equipment (which I have done with my young daughter). Programming languages like Python are actual languages and not easy to master. Just start from square one instead of skimming everything all at once and see where it goes.
And once you have implemented it, you’ll know Python.
Tip-toeing gently out of this thread.
While true, I don’t know how to begin on that problem. What I don’t understand about it is that it seems like I need a list of men and women and they need to have some sort of preference to the person they are paired with.
I think I’ll start with something like a random quote generator and make revisions that get gradually more advanced with more features. Eventually ending up with a GUI.
Project Euler and the Python Challenge are also good places to find problems you can solve with computers as learning projects.
I don’t use python, and I’m a fairly experienced programmer, so I’m not going to be very specific and please take what I’m saying with a couple of spoons of salt.
I think you should get a python book aimed at absolute newcomers to programming. Since python is supposedly designed to be easy to comprehend this should not be that hard. If you’ve got the cash to spend, also get the most authorative “reference” book on the language. You’re going to need it sooner or later, and in my experience, books are a better way to learn a new language than online docs, just because they’re easier on the eyes.
What you’re looking for once you’ve got those books (and read at least the introduction of the first one) is some sort of of “cookbook” recipes. Programming cookbooks are actually common to the point that “cookbook” is pretty much an established term - google for “python cookbook” for example). You may want to take a look at http://oreilly.com/catalog/9780596001674/ and http://pleac.sourceforge.net/pleac_python/index.html