Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Python Interviews

You're reading from   Python Interviews Discussions with Python Experts

Arrow left icon
Product type Paperback
Published in Feb 2018
Publisher
ISBN-13 9781788399081
Length 366 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Michael Driscoll Michael Driscoll
Author Profile Icon Michael Driscoll
Michael Driscoll
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface
1. Brett Cannon
2. Steve Holden FREE CHAPTER
3. Carol Willing
4. Glyph Lefkowitz
5. Doug Hellmann
6. Massimo Di Pierro
7. Alex Martelli
8. Marc-André Lemburg
9. Barry Warsaw
10. Jessica McKellar
11. Tarek Ziadé
12. Sebastian Raschka
13. Wesley Chun
14. Steven Lott
15. Oliver Schoenborn
16. Al Sweigart
17. Luciano Ramalho
18. Nick Coghlan
19. Mike Bayer
20. Jake Vanderplas
Other Books You May Enjoy

Chapter 1. Brett Cannon

Brett Cannon

Brett Cannon is a Canadian software engineer and Python core developer. He is a principal software developer at Microsoft, where he works on editing tools. Previous roles include software engineer at Google and creator at Oplop. Brett became a fellow of the Python Software Foundation (PSF) in 2003 and served as a director of the PSF between 2013 and 2014. He is a former PyCon US committee member and was conference chair of PyData Seattle 2017. Brett led the migration of CPython to GitHub and created importlib. Among his open source achievements is caniusepython3 and he is the co-author of 17 successful Python Enhancement Proposals.

Discussion themes: core developers, v2.7/v3.x, Python sprints.

Catch up with Brett Cannon here: @brettsky

Mike Driscoll: Why did you become a computer programmer?

Brett Cannon: I always found computers interesting, as far back as I can remember. I was lucky enough to go to an elementary school with a computer lab full of Apple IIes, back when that was the cutting edge, so I was exposed to them relatively early on.

In the year between junior high and high school, I took a computer class over the summer and that included a little bit of Apple BASIC. I did it and I excelled at it, to the point that I think I finished the entire class in the first week. It hadn't really clicked that I could do that for a job at that point.

This continued through high school, and then when it came time to pick courses for junior college, my mom had me promise her two things. I agreed that I would take a course in philosophy and I would take a course in computer programming. So that's what I did and I loved both.

Once again, I read my introductory C book in the first two weeks, which was supposed to last for the whole semester. I remember the first time I finished it, I sat down and implemented tic-tac-toe one day after class. I even forgot to eat dinner! It was just one of those eureka moments. The feeling of boundless creativity that this tool provided just engulfed me. That's how I got into programming.

Brett Cannon: 'The feeling of boundless creativity that this tool provided just engulfed me. That's how I got into programming.'

I knew that tic-tac-toe was a solved problem, so I thought that I could actually write the logic so that I could play tic-tac-toe perfectly as a program. I spent something like six hours one evening doing it, and I was utterly blown away that I was actually able to do that. It opened up the possibilities of what computers could do, and the freedom of it and the ability to think about the problems just really grabbed me. I've been doing it ever since.

Driscoll: What led you to becoming so involved with Python and its community?

Cannon: Well, I ended up going to Berkeley and getting a degree in philosophy, but I kept taking computer science courses. The introductory computer science course at Berkeley had an entrance exam, and I was worried that I didn't know object-oriented programming, since I only knew C. So I looked around for an object-oriented programming language. I found Python, learned it, loved it, and kept writing personal programs in it.

At some point along the way, I needed time.strptime, the function to take a string that represents a datetime and parse it back into a time tuple. I was on Windows at the time, and time.strptime wasn't available on Windows. As a result, I came up with a way to parse it where you had to still plug in the locale information but it would still parse it.

Back then, ActiveState's cookbook site was still a thing, so I posted my recipe of how to do strptime up on ActiveState. Later, O'Reilly published the first edition of Python Cookbook, and Alex Martelli included that recipe as the last recipe in the book, which also happened to be the longest recipe in the book.

Brett Cannon: 'So I posted my recipe of how to do strptime up on ActiveState.'

It still ticked me off, though, that people had to input their locale information. I was frustrated that I couldn't solve that. So in the back of my mind, I was continuously thinking about how I could get that locale information out. Eventually, I solved it. It was actually the week after graduating from Berkeley, and I gifted myself the time to write up the solution, so that you didn't have to enter locale information anymore.

After I did that, I emailed Alex Martelli, since we'd exchanged emails a couple of times at that point, and I said, "Hey, I've fixed this so it's not necessary to input the locale anymore. How do I get this upstream?" Alex Martelli said, "Oh, well you just email this mailing list, Python-Dev, and you can submit the patch."

Brett Cannon: 'Alex Martelli said, "Oh, well you just email this mailing list, Python-Dev, and you can submit the patch."'

So, I emailed the list and I think Skip Montanaro was the first person to respond. Skip just said, "Yeah, that's great, just upload the file and we'll work at it and accept it." I thought that was awesome. I was able to contribute to this project and this language, which I thought was really interesting.

Brett Cannon: 'I was able to contribute to this project and this language, which I thought was really interesting.'

All of this happened during a gap year I was taking between undergraduate and graduate school. I was trying to get into graduate school for computer science and I knew that I was going to need some more programming experience, beyond the courses I was taking. I thought that I could contribute to Python and help out. I had all the time in the world back then, so I decided I'd get involved.

Brett Cannon: 'I decided I'd get involved.'

I got on the mailing list and I lurked around asking questions. Then in that same year, I offered to start taking up the Python-Dev summaries, which had stopped at that point. Once again, I figured I had the time to do it, and I realized it was a good way for me to learn, because it forced me to read every single solitary email in Python-Dev.

One interesting side effect was that I got to know about any small issues that nobody had time to take care of, so I saw anything that cropped up before almost anybody else. I was able to very easily pick up small issues to fix and learn, and I was able to continually do that.

In the guise of the Python-Dev summaries, I got to ask more and more questions.

At some point, I knew enough, and I became a core developer right after the first PyCon (at least the first conference labeled PyCon), in 2003. At that point I was hooked. I'd got to know the team and the people had become friends of mine. I just enjoyed it so much and it was fun, so I stuck with it and I've never really stopped for longer than a month since.

https://wiki.python.org/moin/GetInvolved

That doesn't mean that you have to be a core developer to get into the Python community. As long you enjoy it, you can get hooked however it makes sense to you.

Driscoll: What then made you decide to start blogging and writing about Python?

Cannon: Blogging is one of those ways to get involved and since I enjoy writing, that medium happened to fit the way that I like to communicate. I started doing it way back when, and I've more or less consistently done it ever since. I always enjoy that aspect of dispensing knowledge to the world as best as I can.

Driscoll: Was it important that you got into Python at just the right time? Do you recommend getting in early on projects?

Cannon: Yes, it was one of those situations where I was in the right place at the right time, and with the free time I needed to get going. I managed to start when I had enough time to contribute as much as I wanted.

I also got started when the Python project wasn't that big. I remember when I started my master's degree, people would ask what I did in my spare time. When I said I contributed to Python, they'd reply, "Is that the language with the white space?" So I've just been doing this for a long time.

So yes, I got involved in the project at an ideal point, before interest in the language surged around 2005. I sometimes wish that I'd been able to get started with it earlier somehow, but I'd have been younger, so that might not have worked. So it was serendipitous that it all just came together when it did.

Driscoll: What parts of Python have you actively contributed to? Is there a module that you helped start or you had a major influence on, such as the datetime module?

Cannon: My influence was actually the time module. I predate the datetime module! The first modules that I ever authored were the dummy_thread and dummy_threading modules that were in Python 2.

That was another one of those instances where someone came forward and recommended it as a cool thing to do. They said they'd get to it, but over time they didn't get to it, so I emailed them saying, "Hey, are you going to get to this?" They said no, but that it would still be a useful thing to do, so I did it. Those were the first modules that I ever authored from scratch.

I've essentially touched, I think, everything in the Python language at this point. I've even touched the parser, which very few people ever have to touch. I think that I helped to write warnings for some tokenization thing at one point. I played a big part in the compiler, when we switched from going from a concrete syntax tree to byte code, to then having a proper concrete syntax tree, to an abstract syntax tree to Python.

Brett Cannon: 'I've essentially touched, I think, everything in the Python language at this point.'

Jeremy Hilton had started that project, and Guido van Rossum basically gave everyone an ultimatum, because the project had been taking years to finish. So Guido said, "You have until the next release to finish this."

Brett Cannon: 'So Guido said, "You have until the next release to finish this."'

I jumped in and helped Jeremy to carry it the last half of the way. I did a similar thing with the warnings module. Neil Norbits had started to implement it, but he kind of drifted off the project, so I picked it up and finished it the rest of the way. That's how I ended up being one of the people who knew the warnings module a little too well!

What else has led me to becoming so involved in Python? Probably the one thing that I'm most known for is importlib. I wrote most of the current implementation of import (all of it for Python 3.3) and then Nick Coghlan and Eric Snow helped a lot subsequently, but the whole importlib package was my doing. Those are the ones that come to mind in terms of what came directly from me, but I've basically just touched everything everywhere. I can't keep track anymore after 14 years!

Driscoll: I know what you mean. I hate it when I come across some code and I think, "Who wrote this, and why is it so bad?" I then remember that I wrote it a good two years ago!

Cannon: Yeah, if you manage to read your own code from six months ago and it still looks good, then there's probably something wrong. It usually means you haven't learned something new yet.

Brett Cannon: 'If you manage to read your own code from six months ago and it still looks good…it usually means you haven't learned something new yet.'

Driscoll: What do you consider to be the best thing about being a core developer of Python?

Cannon: Probably just the friendships that I've made through being one. A lot of the core developers are friends of mine.

We get together once a year and I get to spend almost 24 hours a day for a whole week with a lot of these people. That's on top of the time I get to spend with them online throughout the rest of the year. It's probably more time than I get to spend with a lot of my friends, because how often do you actually get to take basically a full week of vacation with good friends of yours?

So yeah, it's honestly the friendships at this point. It's being able to hang out and work with these people, learn from them and enjoy what we do and keep doing that.

I don't think about the impact of Python very often. It's a little mind-boggling sometimes to think about, so I try not to dwell on it. I don't want any form of an ego because of it, so I try to actively not think about it too much. If I do just sit here and think about working on this language that's used by however many millions of developers, then that's a bit of an eye-opener. It's kind of cool to be able to say that I work on that, but primarily it's about getting to work with friends.

I still remember very clearly when I first joined the team, and even further back when I joined the mailing list, so although people say I'm one of these big high-up leads on the Python developer team, I've never fully acclimated to that idea. I just don't think of myself that way. Guido famously was once asked at Google, "On a scale of one to ten, how well do you know Python?" He said an eight.

'Guido famously was once asked at Google, "On a scale of one to ten, how well do you know Python?" He said an eight.'

No one knows the entire system, because it's way too big a program to know. We can all fit the basic semantics in our heads, but not all the intricate details of how it actually works. How many people know descriptors or meta classes like the back of their hand? I have to look up that stuff on occasion, so nobody knows the whole system.

Driscoll: So where do you see Python going as a language, as a whole? Do you see it getting more popular in certain fields, or is Python getting into legacy status like C++?

Cannon: Python is in an interesting position today, where there are very few places where Python hasn't penetrated into as a major player. Sure, there are certain areas, like low-level operating systems and kernel development, that don't suit Python, but otherwise it can feel like Python is pretty much everywhere.

The one place I know we're still second with Python is in data science. I think our growth trends project that Python won't immediately overtake R as a data science language in the next couple of years at least. But long term, I do think that Python will catch up. Otherwise, I just don't know very many other fields, that don't require a systems language, where we aren't competitive for first place with Python.

I suppose another area, where Python isn't so strong, may be desktop apps, to a certain extent. Even on the desktop, people use us, so it's not like it's devoid, but there's just a lot of competition in that space. In the long term, and we might even be there already, we will hit the tipping point where there's so much Python code everywhere, that Python itself will probably never go away.

Brett Cannon: 'In the long term, and we might even be there already, we will hit the tipping point where there's so much Python code everywhere, that Python itself will probably never go away.'

Hopefully, Python will never be uttered in the same passing breath as COBOL, and maybe we'll be loved a little bit more and for longer, but I don't see us ever really going anywhere. I think there's just too much code at this point to have us ever disappear.

Driscoll: Python is one of the major languages in the current AI and machine learning boom. What do you think makes Python such a good language for this?

Cannon: I think the ease of learning Python is what makes it good for AI. The people currently working in AI has expanded beyond just software developers, and now encompasses people like data scientists, who do not write code constantly.

That means that there is a desire for a programming language that can be easily taught to non-programmers. Python fits that need nicely. You can look at how Python has garnered traction with people in the sciences and in computer science education, to see how this is not a new trend.

Driscoll: Should people move over to Python 3 now?

Cannon: As someone who helped to make Python 3 come about, I'm not exactly an unbiased person to ask about this. I obviously think people should make the switch to Python 3 immediately, to gain the benefits of what has been added to the language since Python 3.0 first came out.

Brett Cannon: 'I hope people realize that the transition to Python 3 can be done gradually, so the switch doesn't have to be abrupt or especially painful.'

I hope people realize that the transition to Python 3 can be done gradually, so the switch doesn't have to be abrupt or especially painful. Instagram switched in nine months, while continuing to develop new features, which shows that it can be done.

Driscoll: Looking ahead, what's happening with Python 4?

Cannon: The Python 4 thing is a whole conversation of its own, of course. I haven't heard much about Python 4, and I'd be happy to hear about it. It's mythical and it doesn't exist. Python 4 is like Py4k dreaming versus Py3k. Just where could the language go?

When it becomes time to do Python 4, we'll probably clean up the standard library a good amount and strip it down. There are some language elements we'll probably finally get rid of, instead of leaving them in there for compatibility with Python 2.

Brett Cannon: 'When it's time to do Python 4, we'll probably clean up the standard library a good amount, and strip it down.'

For Python 4, we'll likely have a tracing garbage collector, instead of reference counting to get that parallelism. I don't know yet, but that's where I see it going: more or less the same, especially because we've come to rely more on the things that the community has built up around Python. I mean, one of the reasons we have huge standard libraries, is because it negates the internet, right?

Python itself predates Unicode as an official standard, because Python first went public in February 1991 and Unicode 1.0 went final in October 1991. I wasn't aware of that. I had to look it up, because it's one of those things where people ask me, "Hey, why didn't you do Unicode from the beginning like Java?" It's like, well, we predate Unicode, so that's why!

So in the future, I don't think the standard library will need to be quite as big as it is today. We don't need it to be if you can just pip install the equivalent libraries.

We're lucky enough to have a vibrant community, so we have lots of alternative third-party libraries that are of such a high standard, that we can probably thin out the standard library and lower the maintenance burden on the core developers. I think we can do this in some future Python releases without any risk to the community being able to access quality modules. I think it'll make Python easier and leaner, and just better to work with.

Brett Cannon: 'So in Python 4, I don't think the standard library will need to be quite as big as it is today.'

That's what I suspect we'll do, but I don't get to make that call. It sounds like a good dream anyway. So yes, hopefully! I'm yet to have anyone tell me I'm completely insane when I answer questions about Python 4 with these ideas, which is a good litmus test.

Driscoll: What do you think is driving the recent and growing interest in MicroPython?

Cannon: People do keep asking me about writing about MicroPython. While I don't use it myself, I think that it must be getting bigger, because I keep getting asked about it! I'm willing to bet it's because of the education sector, with a lot of people using microbits and all that stuff. So that's probably where all the MicroPython interest is coming from.

Driscoll: How can we all start to contribute to the Python language? How do we get started?

Cannon: We have this thing called the Dev Guide, which I started writing back in 2011. Its full name is the Python Developer's Guide. Basically, the Dev Guide outlines everything you need to know so that you can contribute to the Python language.

Brett Cannon: 'The Dev Guide outlines everything you need to know so that you can contribute to the Python language.'

The Dev Guide (https://devguide.python.org/) shows you how to get the Python source code, compile it and run the test suite. It offers suggestions for how you can find things that you'd like to contribute. You'll also find the documentation for core developers, which shows you how you can do a code review and everything else.

The Dev Guide is a rather large document at this point and it's kind of taken on a life of its own. I just tell people to go and read the Dev Guide, and try to have an idea about what you want to help with. Pick a module that you're really familiar with, that you could help to fix bugs in, or that you feel very comfortable with.

We have a core mentorship mailing list as well, which is not archived on purpose so that you can ask any question, and you don't have to worry about someone finding it five years later. So sign up for core mentorship, read the Dev Guide and then find something that you want to do!

Driscoll: Can we contribute to Python through code reviews?

Cannon: Yes, in fact at this point I've actually started to try to nudge people towards doing code reviews, so if you're really familiar with a module and there's a pull request on GitHub for it, please go for it and do a code review for that pull request.

If you feel comfortable doing code reviews and reviewing stuff on a module that you use regularly or not, that's a really great way to contribute to the development of the Python language.

Brett Cannon: 'If you feel comfortable doing code reviews and reviewing stuff on a module that you use regularly or not, that's a really great way to contribute to the development of the Python language.'

The biggest limitation we have, in driving Python forwards, is the bandwidth on the core developers. So your code reviews can really help to make the projects easier to manage. Please help us to get more patches in, and bugs fixed, by joining in.

Driscoll: How else can we contribute to the Python language?

Cannon: A big help to the Python community is to answer questions that you see people asking about Python, and to answer those questions by just being open and honest. It's also important, of course, not to be a jerk when you talk about Python. It's fine to just be nice about it.

Driscoll: Are there any Python projects downstream that someone can jump in and contribute towards?

Cannon: Yes, if you don't find a current module that interests you, then you might find it interesting to contribute to some of the Python projects more downstream that need the help. For instance, the next version of the Python package index can always use some help. Jump on board if you find something downstream that you find interesting.

Driscoll: How about starter projects?

Cannon: Honestly, it's really kind of hard to have starter projects. We typically have enough people who are involved and watching to just jump on and fix them instantly. So it's hard to get started sometimes, which is why I'm starting to push for more of the pull request reviewing.

Driscoll: During PyCon, I see that there's usually a sprint set on the Python language. What sort of things do you guys do in those PyCon sprints?

Cannon: I've led a number of those PyCon sprints myself, and what we usually do is sit the Python core team down around some tables in one of the sprint rooms, and more or less just say, "Hey, if you want to contribute then come on in."

We tell PyCon sprint attendees the exact same things that we say to everyone who wants to contribute remotely: here's the Dev Guide, read it, get your tool chain up and running, and look for something to work on. If you find something then go for it.

Brett Cannon: 'We tell PyCon sprint attendees...here's the Dev Guide, read it, get your tool chain up and running, and look for something to work on.'

Of course, at the sprints, we're there in the room to answer any questions that anyone may have. Typically, someone like R. David Murray will find a list of easy bugs to hand out to people in the sprint room. It's a great opportunity for people to come in and say hello. If they want to start contributing, then they have core Python people in the room, so they have a quick turnaround time for answers, instead of having to wait until someone sees the email and replies. It's very much just turn to the person to your left, or to your right, and you can ask and you get your answer.

Sometimes we'll give a short presentation to set out where we're going during the sprint, and if people can join in then that's great. We say, "Here are the tools, here's how you run the build, and here's how you run the tests." Then we get coding.

The sprints are very laid back and relaxing compared to the rest of a conference. I thoroughly recommend them when you can make them. It's just not as hectic in a sprint room as in the main area of a show. That's because there are less people, and everyone's just kind of sitting down and relaxing. There are no transitions, except to and from lunch, and it's easier to find people to have conversations with, which is great. So sprints are definitely fun to go to, and I'm going to try to go to one in the next year or two if I can.

Brett Cannon: 'We say, "Here are the tools, here's how you run the build, and here's how you run the tests." Then we get coding.'

Driscoll: Some other teams have nice little enticements too, like if you are helping out with Russell Keith-Magee's BeeWare project, where you get a challenge coin on your first contribution. Have you seen those?

Cannon: Yes, if you help Russell's project out he gives you a challenge coin. It's a big and impressive metal coin. The one I'm holding in my hand right now is one that I earned from Russell and it takes up a good chunk of my Nexus 5X screen!

Here's how I earned my challenge coin from Russell: if you make a contribution that the BeeWare project accepts, such as docs or what have you, then you get one of these coins the next time you see Russell in person. So in my case, I happened to be on Twitter one day when Russell tweeted about an example repo, and I found a couple of typos. I sent a pull request to get them fixed and that's how I finally got my coin. I'd been wanting one for ages, because I think it is a really cool token of appreciation, and anyone can earn one if they contribute.

If you don't know anything about challenge coins, then 99% Invisible had a really good podcast episode explaining these things (https://99percentinvisible.org/episode/coin-check/).

Brett Cannon: 'If you don't know anything about challenge coins, then 99% Invisible had a really good podcast episode explaining these things.'

Driscoll: Does the Python core team offer some incentives like Russell's challenge coins? What do you feel is the core spirit and incentive for people to contribute to the Python language?

Cannon: I've always wanted to make a challenge coin for Python, both for people who are core developers and for people who have contributed a patch. That's a neat idea. But I also don't travel as much as Russell, so it's a little harder because I'd need to be at the conferences that people are attending in order to give them the coins. But it's a cool idea and I wish more projects did it.

The Python core typically takes a very, kind of, passive approach to incentives. It's true, but that is really just because we're putting most of our time into the Python language elements that we want to get done, and we know that a lot of people are going to appreciate. That really is our deep incentive to contribute to Python, and I welcome everyone to join in, whether remotely, or during a conference sprint.

Driscoll: Thank you, Brett Cannon.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime