My previous post, How To Get Really Distracted and Not Learn Any Python, generated enough interest (or at least comments) that I wanted to follow up with some comments of my own.
I have been learning Python in my spare time for quite a while and I am no expert, but I am at least fairly comfortable in it by now. I was reflecting back on what I saw as some missteps I took along the way. The mistake I made was to try and take on too much at once. Instead of just trying to learn Python, I was mixing in learning Linux, a new IDE, a new source control system, etc. All of these are certainly good things to learn, but learning them was not essential to my main task of learning Python.
For the curious, I found the following to be useful activities for actually learning Python:
- Read the official Python Tutorial – I’m not kidding, the official docs are good
- Study Core Python by Wesley Chun – The weight of this book may damage your wrist, but the quality of the information is superb. I read a chapter at a time, then reread the chapter and make notes
- Download and install Django, complete the first tutorial and then try to trace the flow of the code so you can see where the default Django page comes from – I used Wing IDE Personal edition to set up breakpoints and step through
- Read and try to understand the code in a Python standard module – for example, if you are looking at Django or other web frameworks, take a look at the HTTP/TCP/SocketServer family of classes
And MOST importantly, write some code! Writing code is best because it is so humbling; you are not just nodding along to an example in a book, you have to be a creative participant. Sometimes though, it can be tough to know what code to write. To avoid “coders block”, I need to have a goal to work towards. Things like the Django tutorials are a good place to start if you have no ideas. However, things really started clicking for me when I came up with a project idea: write some Python code to read barcodes from books/DVDs via a webcam and then use the resulting barcode to look up information about the book and store that information somewhere; basically a Delicious Library knock off. Kind of silly, but motivating.
And speaking of silly, but motivating (this is begging for a sequel), I present (for the second time) the following Erlang video: on Google video (with longer introduction) and YouTube (slimmed down version). The pinnacle of the driest humor or just unintentionally hilarious? You decide.*
* In anticipation of angry comments from Erlang partisans, I would note that for the last paragraph of this post tongue was back in cheek.
The following is a graphical breakdown of how I spent the first 40 hours or so “learning” Python, plus an excuse to show off the Google Visualization API:
As you can see, based on these extremely scientific measurements, I spent the majority of this time not writing Python code, reading about it or watching screencasts, but instead fiddling around the edges. These are important edges; as a .NET programmer by trade, I know well the importance of a good IDE. Source Control is a given, while Test Driven Development (TDD) is a staple of many non-corporate programming environments. And of course you cannot write any code if your environment is not set up correctly.
So why do I call this time spent “fiddling”? Because of the way I approached it. I took having a good IDE to mean finding a Visual Studio for Python. This meant installs and brief trials of Wing IDE, IronPython Studio, Eclipse and E-Text Editor. TDD was slow sledding when the test was really writing anything that worked. Environment setup became an brief foray into Linux followed by endless tweaks of Windows settings to come up with the perfect Python environment.
I approached getting started with Python as I would setting up a new machine for .NET development, except I have years of experience with .NET and know exactly what I want, whereas I was grasping in the dark with Python. Once I got past these obstacles and got rolling (in Vista, with SVN and Eclipse for the curious), I actually began making some progress. While I learned a lot from the process, it was also needlessly frustrating. If learning Python was my number one goal it would have been better to just take others’ advice, get set up by following a laundry list of instructions and try to end up with a more distraction free allocation like this:
&chl=Python%7CEnv.%20Setup%7CSource%20Control%7CTDD%7CIDE&chdl=Percentage%20of%20Time&chd=s%3A9BBBB&chco=CC6600&chly=85%7C42.5%7C0)
Of course, far be it for me to take my own advice, and I have not been able to resist taking some time to brush up on my JavaScript, which lead me to the Google Visualization API, which is responsible for the oh so orange graphs in this post. The Visualization API is one of many JavaScript libraries which Google hosts on its servers, allowing you to load them onto your own page hassle free. Not all the libraries are Google-made, the impressive jQuery is another library you can import off of Google’s servers. I did not do much more with the Visualization API then you can see in the “Hello World” examples, but the magic is there in the source of this page if you are curious. <Updated post to display better in RSS readers>