Notes from Pycon 2017
June 15, 2017This year I finally got to attend Pycon. Having only attended a way smaller conference before (PyBay 2016) it was awesome to see the insanity that comes with cramming 3000+ pythonistas (!) into one convention center. I made an effort to branch out from just going to the talks, and spend some time talking to people and making connections. It was totally worth it.
As I expected, there was a lot of talk about Python 2 vs. Python 3 (there was even a guy walking around with a shirt that only said “2.8” on it) but the overall feeling I got was that people are moving away from 2.7. Those who are working on a (mostly) 2.7 codebase (like me) are doing so due to the existing legacy code, and inertia, not due to a lack of desire to upgrade. Python 3 is the shiny new thing, after all. Between the asynchronous story, and all the features that focus on making it easier to write less error-prone code, it seems like the community is coalescing around the 3.6 release, and looking towards a bright future.
Below, I’ve summarized some of the better talks that I attended. For a less technical view of my trip to PyCon, check out my other Portland post, which has a bunch of photos, too. Anyway, talks:
- Grok the GIL: Write Fast And Thread-Safe Python - A. Jesse Jiryu Davis
- In this talk, Davis discussed the Global Interpreter Lock, what it is, and why it is necessary. In short, in CPython only one thread can run Python code at once, while others sleep or wait. The GIL is the mechanism through which a Python process handles the cooperative and preemptive multitasking that decides which thread runs the show, and studying the inner workings of the beast can help us avoid the bugs that come from running multi threaded Python. I definitely recommend watching the talk, but if not, at least take a look at Davis’ write-up. To see these kind of bugs in action, you can also run this quick demo I wrote.
- Presentation
- Video
- The Dictionary Even Mightier - Brandon Rhodes
- A rehash of Brandon’s old 2010 talk, revamped for Python 3 in 2017. It is odd how having started coding in Python in the 2.7 era means that I take so many of these features, including a few backports, totally for granted. Since python is
dicts
all the way down, the effects of the whole laundry list of dictionary features and gotchas was pretty interesting. My favorite section was the demo on hash collisions/complexity attacks, where Rhodes had a great visual explanation of why bad hash functions are bad. Another highlight was the explanation of the new private dictionary version that shows up in 3.6. Jake VanderPlas’ has a good post on how to expose this private version, although he doesn’t go deep into the use cases, the most important of which will be optimizing fast checks on whether a dict has changed. - Presentation
- Video
- A rehash of Brandon’s old 2010 talk, revamped for Python 3 in 2017. It is odd how having started coding in Python in the 2.7 era means that I take so many of these features, including a few backports, totally for granted. Since python is
- Requests Under The Hood - Cory Benfield
- The point of this talk was simple: Even the “best python codebases” have warts. This is partially due to the nature of open source, and partially due to the complexity of managing large systems. Paraphrasing:
”
$foo
would have been the right way to do this, but instead we did$bar
. It mostly worked and people stopped complaining. So, the emergent behavior of$bar
, even if wrong, became what users expected and now need, so we can’t change it… because there are no tests.”
This sounds like a nightmare I’ve had before. In all seriousness though, it is humbling to see that even super successful projects run into these issues.
- The point of this talk was simple: Even the “best python codebases” have warts. This is partially due to the nature of open source, and partially due to the complexity of managing large systems. Paraphrasing:
- async/await and asyncio in Python 3.6 and beyond - Yuri Selivanov
I’ll go ahead and say that a lot of this went over my head. While I understand the ideas behind
asyncio
, I have not played with it enough to fully get the added value of some of the potential new things coming in 3.7. However, this new model will provide the building blocks for other frameworks and libraries that are already in the pipe - looking at you curio and trio! For a more beginner’s friendly version of it, take a look at Miguel Grinberg’s presentation.- Presentation
- Video
- Bonus: Modern Python Dictionaries A confluence of a Dozen Great Ideas - Raymond Hettinger
- It is kind of unfair to list this talk along the other ones, since I didn’t actually go, but having seen a previous version of the same talk, I know it is good. The optimizations discussed in this session are one of the main reasons why Python 3’s underlying
dict
objects are so lightweight compared to their 2 counterparts. - Presentation
- Video
- It is kind of unfair to list this talk along the other ones, since I didn’t actually go, but having seen a previous version of the same talk, I know it is good. The optimizations discussed in this session are one of the main reasons why Python 3’s underlying
The rest of the talks can be found here, and the recorded videos in this YouTube Channel. I definitely recommend you take a look, and for some more inspiration you can always check out my resources repo, which is full of talks and articles worth watching.
Conferences are worth it for the networking, and for the learning, but most of all, for the motivation that comes from seeing awesome people showcase their projects. After my trip, I came back with a whole lot of things to try, and a ton of energy to burn through. Python is as strong as ever. See you next year!
Photo: by me, also posted on Portlanding
Want to see more articles like this? Sign up below: