Home All Posts

Learning Python, Part 2

2018-12-16

My progress slowly continues on my path to learning Python. To help me in this task, I purchased a few books, the first of which I’m working through (slowly) now. That book, Learning Python, by Mark Lutz, is a massive tome on the Python language proper. By massive tome I mean about 1500 pages of text covering versions 2.x and 3.x of Python. It starts off with the basics and goes into more advanced topics, and, as far as I can tell, covers all aspects of the language itself. Lutz has another book, Programming Python, another massive tome which I also bought, that covers the libraries and application programming.

Now, of course after starting to learn Python (and liking the language), I’m already questioning if I should have went with learning Ruby instead (Rails?) but I’m trying to keep that out of my mind for now. I’m trying to keep a healthy balance of learning topics out of a purely career based interest while allowing time for personal interests to also take hold. Fortunately fo me, these interests frequently overlap, and learning Python was a little bit driven by both. That’s part of the reason why I started thinking about Ruby and Rails, but anyway, I can always learn Python and then Ruby if I really want.

While I’ve only written a hundred lines of Python and played around in the REPL to get a feel for different aspects of the language my initial impressions are positive. Python strikes me as a simple language to get started with that has a lot of power at the same time. Comprehensions, generators, strong functional programming aspects, and a solid group of builtin types make it possible to get a lot done in short order, making it a strong scripting language. The fact that there are numerous libraries and frameworks available for use with Python make it easy to see that learning Python is a pretty good investment in time regardless.

Working through the book it’s clear that while Python is an “easy” language to learn, it has enough nauance and power to trip up beginners, as any language would. The book Learning Python covers both 2.x and 3.x, and there are a few differences between the two such as how certain functions and iterables work which I’m sure will result in future googling and visits to StackOverflow. That said, being familiar with garbage collected languages and mutable data structures makes many aspects of Python familiar. I personally am warming up to the lack of curly braces and semicolons. Python’s insistence on using indentation for indicating code blocks is different from say Go or C#, it doesn’t appear to hurt the readability of code in general.

So far I haven’t used Python enough to get familiar with its warts. From browsing the web it looks like there may be some pain around packaging and distributing modules, but, this certainly isn’t unique to Python. Given that Python is interpreted it would certainly make sense not to use it in some performance critical application domains, but for hobby projects and scripting it has much to offer. Python has a great set of mathematics and machine learning libraries which I’d like to approach in the future. I still need to get around to that discrete math course on Coursera..

Anyway, the more I play with Python that happier I am with picking it as a language to learn. I’m slightly regretting picking up such a big book as a guide to the language, as I think I’ve been spoiled by the density of information in SICP and the brevity of Scheme. That said, Learning Python is a great reference if it is on the long side.