Sharpen the Python Saw or Die Trying

Reminder – you can still win a free copy of NumPy Cookbook during the giveaway period.

Don’t take the last part of the above title too seriously, unless the world ends next week as it should. One of my most popular posts was “Sharpen the Vim Saw“. I will therefore attempt to write about sharpening the Python saw in 10 times less time. I just don’t seem to have enough time these days (and the Apocalypse is imminent). Also this text should be 10 times more promotional, which can’t be helped. Be warned! Let’s define the 7 habits of highly effective Pythonista. This is, of course, my own list so it might not make sense to everybody.

Photobucket

1. Know thy language and be Pythonic

If you are going to program in a language, you should know as much as humanly possible about it. You should know about list comprehensions, generators and have read the Zen Of Python. It helps if you know a couple of cool tricks. Such as starting a simple HTTP server:

   python -m SimpleHTTPServer

or swapping values:

   b, a = a, b

Due to lack of time, I will keep the list of tips and tricks short. Certainly tens or hundreds of other items can be added. Feel free to add more in the comments.

2. Know thy API’s

Reinventing the wheel is bad! Mmmkay. Always make sure that you are using the best tool, library or module for the task at hand. I have made a list of useful Python API’s on my Python Libraries Quora Board. If you ask me NumPy is one of the most brilliant libraries out there, but of course I am bound to say that having written two books on the subject.

3. Test thine code

The first law of programming is – “You are going to make mistakes“. Therefore you need to test your code, which means unit tests. One can use techniques such as mocking and BDD. My newest book NumPy Cookbook features a number of testing tutorials.

4. Be social

To be part of a community, such as the Python community, you have to be social. Yes, I know – who has the time to be social; we want to code and get things done, right? However, it’s not as bad as it sounds. I will help you a bit. Listed below are the world class Python superstars I follow on Twitter:

You could also join one of the Python communities:

By the way there are still free review copies available of NumPy Cookbook at the Linkedin community. Being social also means giving back and sharing everything related to Python like this amazing blog for instance. For example, Mrs. Lemontree from Eyjafjallajokull failed to share a Python article, which resulted in massive unfollowing and unfriending. This could happen to you!

This list again is not exhaustive. All new suggestions are welcome.

5. Stay current

Being social should already help you to stay up to date with the latest gossip. You can also follow the Python subreddit or subscribe to blogs, for instance. I searched for Python in my RSS reader and came up with these blogs:

Here is a free Search Engine Optimization (SEO) tip. If your blog is about Python, consider having the word “Python” in the title.

6. Ask for help

Asking for help is like drinking. You know you want to do it, but you also know that if you do it too often it will have bad, bad consequences. Time for another list again:

  • Ask the neckbeard hacker in the cubicle next to you.
  • Ask on StackOverflow.
  • Ask on Quora.
  • IRC
  • Ask on a mailing list.

Obviously I don’t know what type of questions you are going to ask. Asking questions the right way is both an art and a science. If your questions are about NumPy, I think I can help or at least I know obvious ways that you can help yourself.

7. Sharpen thy saw

Practice! Practice! Coding is like playing a musical instrument only a lot more fun. In my opinion it’s easy to find coding exercises. For instance, you could solve the Project Euler problems. I started blogging my solutions, but was interrupted by more urgent projects. This is still ongoing and I hope to continue soon.

Besides practicing you should continue trying to gain theoretical knowledge. Read books, such as the ones I mentioned a dozen of times already or follow Python courses and lectures online:

Hope to hear from you before or after The End Of The World (as we know it). The following is a list of Python links I came across this week:

By the author of NumPy Beginner's Guide, NumPy Cookbook and Instant Pygame. If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
Share
This entry was posted in programming and tagged . Bookmark the permalink.