Home > Articles > Open Source > Python

Python Is Not Just a Language—It's a Development Platform: An Interview with Doug Hellmann

Cameron Laird interviews Doug Hellmann, author of The Python Standard Library by Example, about his first encounters with Python, his work on Python Module of the Week, and what he's learned from other books.
Like this article? We recommend

It's evident that Doug Hellmann cares more about the success of his readers than the success of his book. During an interview with Doug by long-time InformIT contributor Cameron Laird about the upcoming release of The Python Standard Library By Example, he consistently turned the conversation toward the riches of Python and away from his own contributions. Read for yourself in these excerpts from an e-mail dialogue between Doug and Cameron.

In The Beginning

Cameron Laird: Do you remember how you first encountered Python?

Doug Hellmann: My friend, Dick Wall, introduced me to Python as a scripting language for building internal tools while we were working together at a GIS software company some time between 1996 and 1998. I was in charge of maintaining the build and porting the application, written in C, to run on AIX and the DEC Alpha under their 64-bit UNIX. Python quickly became my favorite language for cross-platform automation, and I used it to manage parts of the build, create test harnesses, and even to generate release notes documents from the bug database. This was all before wide-spread adoption of Web-based user interfaces, so I was doing a lot of command line and Tkinter development, depending on the need at the time.

Cameron: How did the writing start? When did you begin PyMOTW?

Doug: I started blogging in late 2006, and applied myself to it seriously beginning in 2007. The "module a week" theme started in 2007 and served two purposes. First, it gave me something to write about every week, so I could build up the personal practice of writing on a regular basis. Second, it had been several years since I had taken a serious look at the standard library, and I knew there had been changes and additions in that time. Going through the library module by module to write examples gave me a structure for studying the changes and enhancements, and for digging deeper into the modules that I had used only lightly in my projects.

Cameron: Do you personally contribute code back to Python?

Doug: I have commit access, and have contributed a couple of small patches to the CPython documentation. Most of my contributions to the community have come in the form of stand-alone projects such as virtualenvwrapper or writing for PyMOTW, Python Magazine, and now the PSF blog.

Cameron: You choose what will help you improve as a writer: why?

Doug: I enjoy the challenge of organizing information and presenting it clearly in writing. There are a lot of similarities between writing and programming, but writing has aspects of teaching and information sharing that is fulfilling in a different way.

Cameron: When you began PyMOTW in 2007, did you regard "the standard library" as immutable, in a programming sense, or was one of your aims to track what was happening with Python3000, IronPython, and so on?

Doug: There was no question in my mind that the standard library was a moving target. I knew that I would have to go back and address those changes, eventually. It also meant there would be entirely new modules, but since I was covering Python 2.x, that did not come up as often as smaller additions and changes. Part of the work I did during the editing phase for the book was to review every module to make sure all of the important aspects are covered and verify that all of the examples work under Python 2.7. That review resulted in updates in a few cases, and even a couple of bug reports for regressions from 2.6 or 2.5, when the examples were originally written.

I have not focused on the other implementations of Python, so far. The recent discussions about versioning the standard library separately from the CPython implementation should make it easier for the implementations both to be consistent, and to identify clearly any lingering inconsistencies. I hope that means less work for all Python authors—and improved compatibility for developers!

Heart of Python

Cameron: To me, what you write is at the heart of Python action. In school, languages are generally taught with an emphasis on syntax—students come out roughly equating "I know language $N" and "I'm familiar with the syntax of $N". This misses how much of of real engineering practice has to do with intimacy with the (run-time) library. For me, therefore, Standard Library is not just a good book, or a well-written one, but an important one.

Doug: I feel the same way about the standard library as the source of much of Python's usefulness as a tool. Unfortunately, the library is so big that a lot of programmers never have (or take) the time to look beyond the modules they have to use, like os and sys. That means they miss out on some of the really interesting parts, like collections and multiprocessing.

Cameron: Have there been any surprises for you in reader reactions? Are they finding something in the book that you didn't expect?

Doug: It has been fun to see which examples people find the most helpful. Some of the modules I considered "simple" have had the best responses, which makes me glad that I included them. As far as finding unexpected nuggets, I think that has gone the other way. There have been a few cases in which readers pointed out simpler idioms for examples, and several gave me links to third-party modules I had not seen (dateutil and cmd2 come to mind as specific examples). So in addition to the knowledge I gained researching and writing, I also have been learning from their feedback.

Cameron: What did you learn from other books?

Doug: I discovered Python Standard Library as I was preparing the proposal for my own book. I don't know how it could be that I had never seen it before then. I skimmed a copy, but by then most of my writing was done so I did not use it as a reference. I did use David Beazley's Python Essential Reference several times, and have kept a copy of that on my desk since the first edition. I don't have any of Alex Martelli's books, although my impression is that Python Cookbook would be complementary to The Python Standard Library By Example.

Cameron: Like Python itself, Standard Library seems deliberately "stripped-down". All the emphasis is on use of the standard library.

Doug: That was very deliberate. Compiling The History of the Python Standard Library easily could take as much effort as creating all of the examples for this book did! In all seriousness, many of the modules are complicated enough that I wanted to keep the focus on explaining their purpose and showing how to use them successfully. I did not want to become side-tracked with discussions of older implementations or design changes through time. There are one or two places where I do discuss the reason that the library includes several modules that perform the same function (command line argument parsing comes to mind as an example). I don't dwell on details, but I do try to point out how to choose which module to use, when there is a choice to be made.

I decided early on that I was not going to write an introductory text, for a couple of reasons. First, there are far more books available for beginners than intermediate and advanced programmers. I wanted to create a resource for someone ready to take the next step and stretch their abilities. While the book is not devoid of exposition, I did try to make all of the examples stand on their own, though comments, variable naming, and structure. I worked on the size of the programs to keep them small enough that they can be understood without having to pull in material from several modules at a time, while still being large enough that they are useful as "real" examples.

My second consideration was scope. The sheer breadth of topics covered in the standard library means that beginning with the absolute basics for every module would have required writing an entire shelf full of books. The math and networking topics alone would each fill a volume equal in size to this one. My goal was to find the intersection between knowing Python and the domain-specific knowledge addressed by each module. For readers approaching these topics for the first time, I have included brief introductions and lists of references where they can find more details. If I have struck the right balance, the text should be useful both to a Python programmer learning about an application area and to a programmer with some domain knowledge coming from another language.

I don't want to give anyone the impression that they need a huge amount of knowledge to get value from, or to understand, the book. The examples are meant to stand on their own, but I do recognize that readers will have different levels of experience based on the situations they have encountered in their careers so far. I had to do a fair amount of research myself, so I include all of the references I found useful, in case they want more background on a given subject.

This project has definitely given me a much greater appreciation for the amount of foundation work already done by the core developers in building the standard library. Python is not just a language, it's a development platform.

For the Reader

Cameron: What do you know about how readers are approaching the book? Are they treating it as a reference only? Do they try to read it systematically, to learn all of Python?

Doug: I tried to group related topics together, and then order them logically so that someone reading straight through would be building on earlier knowledge. But I don't expect most readers to approach it that way. It is also accessible for someone wanting to "dip in" to find or learn about a single module, or just refer back to a section to refresh their memory. Between the table of contents, the module index, and the topic index there are a lot of ways to jump directly to the nugget of information you're seeking.

Cameron: When can readers get their hands on it?

Doug: It's available for pre-order through online sites now, with delivery scheduled for June. I believe it will be in stores by June, too.

Cameron: What plans do you have for the future?

Doug: I do plan to resume publishing PyMOTW. The next step is to port the existing examples to Python 3. I have begun researching some of what I will need to know for that process, but have not started the coding work, yet. I also have some other unrelated topics that I plan to write about in shorter articles, and I may tackle them first. I will be posting them to DougHellmann.com or on InformIT.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020