Thursday 24 December 2009

Article in Python Rag

Next month's Python Rag contains an article written by me on the topic of namespaces. Knowing what namespaces are and where they are found helps you understand how the language works and explains how simple its concepts of functions, classes and modules are.
On balance I'm happy with the article; I've never written anything like this before and I think I've communicated the point. However, I've definitely identified areas that could be improved. For example:

  • The article doesn't flow. This is because I've tried to back each assertion I make with proof at the Python interpreter. As a result the narrative flow gets over punctuated with example excerpts, and becomes difficult to read and hard to follow. Perhaps I'm too used to writing doctests! Instead, I think I should have dedicated a large set of more creative narrative to each point, and offered bigger and fuller examples to back things up.

  • Not enough visuals. Many of us are visual thinkers, tending to draw pictures in our minds representing abstract concepts. One thing that I think is important about understanding namespaces is that they allow you to visualize python programs, as a sort of containment hierarchy. I really think I could of draw some attractive images to help communicate my point a little better.

  • Not creative or imaginative. Although the article is technical in nature, it doesn't hurt to use a few metaphors here and there, or provide some historical context to certain features or throw in some personal reflection. Perhaps I was preoccupied with being technically accurate, so the result is a little dry.

Fortunately, next month (Feb), I'm writing a follow-up on Python scopes which ties in quite nicely with namespaces. This is the perfect opportunity to address these issues and write a better article!

Wednesday 16 December 2009

WyPY December 2009

Last week I attended the West Yorkshire Python User Group for the second time. There were two talks which I'll give an overview of.

The first, by Wavy (Simon) Davy, was a tour of his experience of Python networking frameworks, specifically Twisted. He contrasted thread-based against non-blocking asynchronous approaches, and demonstrated how the latter afforded significant improvements for a project he was working on.

The second from Peter Russell, was pretty hardcore - he talked about Issue 4753 (I believe) http://bugs.python.org/issue4753. In summary, early versions of Python used a large switch statement to interrogate and dispatch to the correct function to process various opcodes in Python bytecode. He then showed how a recent reworking of the code allowed CPUs to do more clever branch prediction in the execution pipeline!

I promised to provide a talk to the guys next week regarding Zope components, via Grok. Looking forward to it! :-)