Disclaimer: If you already know Python really well, this post might not be handy for you. However, I’d still love to see your comments and feedback if you have a moment to reply.
Much of my recent work has centered on OpenStack and I’ve found myself overwhelmed by learning Python. Although I don’t have any formal education on anything related to computer science or programming, I’ve worked my way through PHP, Perl and Ruby.
Ruby seems to be the most comfortable language for me to use due to the simplicity of the syntax and the handy features provided by the standard libraries and common gems. Python always caught me as strange due to the forced indenting (I indent my code properly anyway, but it still feels weird to be forced to do so), module namespaces and the overall syntax. Things like list and generator comprehension made my head spin and I avoided Python like the plague.
All of that had to change over the past few months. I’m not an expert in Python by any means but I’ll be glad to share with you how I trekked from the depths of Ruby to the edge of Python.
Zed Shaw’s guide to learning Python has been the primary recommendation from every Python developer I’ve polled at Rackspace. It is clear, concise and accurate; however, I never did finish the HTML guide. Something would end up distracting me or I’d become discouraged by something I couldn’t understand.
That’s when I found the video course on Udemy. The video course costs $29 and comes with the PDF copy of the book. You can watch Zed work through the problems on screen via an easy-to-follow screencast. He even makes common errors on screen and runs the interpreter so you can get familiar with exceptions from common typos.
If it’s in Python or the standard libraries bundled along with it, it’s in the Python documentation. There are plenty of code examples for almost all of the methods from the standard libraries on the site. It’s a good resource to bookmark while you’re learning what certain methods do and which parameters they expect. You can also ensure that your code isn’t importing modules that are deprecated.
This could draw criticism from some, but Stack Overflow is a good resource to find better ways to do things in Python. I’ve written some pretty ugly Python code only to find that I could have called a couple of methods from modules found in Python’s standard libraries. You can find lots of examples of code simplification and recommendations for which modules to use for a particular project.
Keep in mind that some suggestions on the site can be subpar. Some may contain deprecated or insecure code that could hurt your project’s success. Be sure to look through the comments after each answer to ensure that you’re reading a solid solution.
Some of the best resources for learning Python are probably all around you in your office or online. I’m extremely fortunate to be surrounded by gifted and experienced developers at Rackspace who genuinely care about their work and want to share their strategies with others. I’ve always had a tough time understanding lambdas (I couldn’t understand them in Ruby, either), but one of my coworkers took me through some examples as I was leaving work.
If you feel like you might be a bother to your coworkers, try to do some homework on the topic first or give them a specific example of what you’re trying to solve. It will show them that you’ve done your best to understand the topic but that you need some help getting over the hump. A hot cup of their favorite coffee or snack doesn’t hurt either.
Find a problem, make a project and write some Python. Most of us have something we’d like to accomplish if we had the time. Take that idea or problem and write Python to solve it. You’ll pick up new knowledge as you work through the project and you’ll probably back yourself into a corner more than once. When it happens, go back to the documentation, do some Googling and lean on your peers.
I’ve been working with Python for just over a month and these strategies have jump started my learning by leaps and bounds. If you’re struggling, drop me a line and I’ll see what I can do to help. I’m also eager to hear your strategies for learning Python so they can be shared with others.
Saw this posted to the Rackspace twitter feed and really enjoyed it! I’ve had so many people ask me in the last three days, after hearing I’ve got a development background, if I know python. I was already determined to at least become familiar with the basics and write a “hello world” program to get me exposed to some of the lingo. This is a GREAT place to start and I don’t have to bug you guys (yet!) Have a great night!
here’s another resource I think is quite useful … https://developers.google.com/edu/python/set-up
Just use C++ Builder, its so easy a child could do it.
For compact loopless code use “J” from jsoftware.com it is free, it is powerful. It is very portable.
I started learning Python on codecademy.com The simple step-by-step tutorials are pretty neat way to get started coding.
Would be very interested to know if you have thoughts on the comparisons of Ruby to Python frameworks – mostly Rails v. Django.
Try CS101 at Udacity.com along with follow up courses in their sequence. Free, online and pretty effective pedagogically.
Regarding coworkers and colleagues, they can be GREAT resource for learning to use computers. When Microsoft Windows 95 and Office 95 came out, nobody in my work group took classes on that software: We learned as we went and helped each other. In a group of 20-40 people, someone is likely to know a trick or two that helps you solve your problem. Taking a class on a programming language is a good way to get a jump start, but in the end sharing knowledge with others in your group of friends and colleagues is still a good way to build skills.
I’m in the process of learning Python, too, since it is available for free on most popular operating systems, the code is portable, and it’s truly a high-level language. Not only can I use it for my personal computation needs, it is gaining ground as a CGI language on the Web, gradually replacing PERL.
My grade-schoolers are fortunate enough to have a school that has computer class as part of their curriculum. Unfortunately, I have never heard of any coding-related projects take place even at the upper grade-level.
I came across a book about Python called, “Hello World! Computer Programming for kids and other beginners” by Warren and Carter Sande. It’s essentially a series of lessons and comes with free (with book purchase) electronic supplemental material. I tried a few lessons in the book at home which the kids seemed to like, but admittedly doing the lessons at home got lost in the shuffle of our daily schedules. With summer break approaching I plan to pick it up again with the kids. I have no affiliation with the authors or publisher–just a parent that realizes the benefits of kids acquiring coding skills. I plan to also take a look at the resources noted in this article and related comments.
For those that don’t already know, having coding skills helps people in many more ways than just creating code. I hope coding in school curricula becomes more mainstream given all the potential benefits to the students and the community at-large.
Why again would I want a, “skill,” that someone else can learn in a month as you have in this article and compete against me for employer dollars? Such a thing doesn’t seem very specialized nor highly compensatable to me, thus not worthy of my interest nor time investment. I’m happy for your progress and glad that you’ve found something interesting, but for myself well, give me something more challenging than Python.
Congrats on getting started with Python. Like with Ruby, you know have access to a multitude of well-crafted libraries. Whether it’s machine learning (pybrain, scikit-learn), NLP (NLTK), scientific computing (scipy), numeric computing (numpy), statistics (pandas), etc. And in spite of any initial difficulties you might have, I’d highly recommend list comprehensions — once you learn them, they are easy to write and read, and you sometimes you get better performance. Iterators are extremely handy, as are generators, and generator comprehensions. You can make pipelines with them, just like unix-style pipelines! For a good introduction to generators targeted at systems programmers, see: http://www.dabeaz.com/generators/
PS: Impressed you know Perl! I never managed to feel comfortable with it.