I use Python once in a while to get some simple work done, like read, write, process or plot some data. I inevitably end up Googling or looking up analogues to C++ constructs on StackOverflow to get the job done. On one such recent stint, I found it useful to refer to the book Python for the Busy Java Developer as I worked on object-orientifying a piece of Python code. On tweeting this, my friend Deepak Sarda, who is also the author of that book offered me a copy of the book for review.
Python for the Busy Java Developer is a short book that enables folks familiar with Java to get started on reading and writing Python with ease. If you already have experience working with other object-oriented languages with a C-like syntax (like C# or C++), this might also be the right book for you. Following a short introduction, the meat of the book is essentially Chapter 2, which is pretty long and takes the reader on a trip through the syntax, lists, functions and classes. Chapter 3 lists the tools and libraries that any seasoned developer would be looking out for while writing code.
There is a big difference between Googling a problem and learning from an experienced person. It is just that kind of insight that I found at many places in this book. By just looking for analogues to C++, I had never realized of the alternate or extra possibilities for certain language constructs. As an example, it never occurred to me that attributes or methods of a class could be deleted outside the class. This is of course in the very nature of a dynamic language like Python, but the thought never occurs to a person coming from a statically typed language.
Though I've been writing short Python scripts for a few years, from this book I found myself learning many tiny details that are sure to help me write code that is more Pythonic. My familiarity is with C++, but I found the analogies to Java in the book quite straightforward to relate to. The concepts are introduced in a natural order and the book can be easily finished in a couple of hours. Places where Python might behave differently or in ways that is better than you except are pointed out. The book is beautifully typeset, which is a quality that seems to be sorely missing in tech books today. A book of this length has to leave out a lot and that is possibly the biggest downside of the book. I was left wanting to learn more of the Python analogues to the other C++ constructs I'm aware of.
I can easily recommend Python for the Busy Java Developer as a quick guide to learn Python if you are coming from C++. You can buy it here for the price of a cup of coffee. But wait! Deepak is offering the readers of this blog a 10% discount, just use this link to buy the book. 😊