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!

5 comments:

Anonymous said...
This comment has been removed by a blog administrator.
Robert said...

> Not enough visuals

Yes definitely. A picture is worth thousand words - I wish there's a drawing of some sort on this as well as the topic of OOP.
Guido's writing on this is good, but - IMO - it's like how the official doc is "written by devs for devs"...so if one is not quite there yet(like I'm new to Python), it may be hard to understand at times (I guess that's why the "for Dummies" books sell)

I visualize in my mind namespaces like soap bubbles (with other bubbles inside). Do you think that's correct ?

BTW, I think you should have mentioned "scope" like Guido did.

Robert said...

Adding to my earlier comment:

ok, I see you indicated that you'd discuss "scope" in the next issue.

Unknown said...

Robert:

Thanks for the comments.

My visualization isn't quite as advanced as yours ;-) I see them as sort of nested circles. Although entirely valid as mental image, one namespace 'containing' another namespace is kind of misleading. They are distinct 'things' in memory, and the compiled function-object just contains a reference to the global namespace.

My next article on scopes contains my interpretation of such things. Perhaps a series on 'Visualizing Python' would be a good shout?

Robert said...
This comment has been removed by the author.