Unravelling the import statement

As part of my series on Python's syntactic sugar, I am going to cover import statements. This will include delving into the quirky interface of __import__()(although in actual code you should use importlib.import_module()). What this post will not cover, though, is how imports wo … | Continue reading


@snarky.ca | 3 years ago

Unravelling boolean operations

As part of my series on Python's syntactic sugar, I am going to cover boolean operations: a or b and a and b. The semanticsA key thing to know about or and and is that they short-circuit. What that means is that if just the first argument is enough to | Continue reading


@snarky.ca | 3 years ago

Unravelling membership testing

This post in my series on Python's syntactic sugar, I am going to cover membership testing: in and not in. As the language reference says, "the operators in and not in test for membership". In other words, in and not in are used to check if an object is contained | Continue reading


@snarky.ca | 3 years ago

Unravelling `not` in Python

For this next blog post in my series of Python's syntactic sugar, I'm tackling what would seem to be a very simple bit of syntax, but which actually requires diving into multiple layers to fully implement: not. On the surface, the definition of not is very straightforward: The op … | Continue reading


@snarky.ca | 3 years ago

Unravelling `is` and `is not`

As part of this blog series on Python's syntactic sugar, I said in the post on unary arithmetic operators that it might be the most boring post in this series. I think I was wrong. 😄 The operators is and is not are very short. The documentation for the operators says | Continue reading


@snarky.ca | 3 years ago

Unravelling rich comparison operators

For the next part of my blog series on pulling apart Python's syntactic sugar, I'm going to be tackling rich comparison operators: ==, !=, >, <, >=, <=. For this post I am going to be picking apart the example of a > b. Looking at the bytecodeUsing the dis module, … | Continue reading


@snarky.ca | 3 years ago

Unravelling unary arithmetic operators

In this entire blog series on Python's syntactic sugar, this might end up being the most boring post. 😄 We will cover the unary arithmetic operators: -, +, and ~ (inversion if you don't happen to be familiar with that last operator). Due to the fact that there is only a s … | Continue reading


@snarky.ca | 3 years ago

Unravelling augmented arithmetic assignment

PrologueThis post is part of a series on Python's syntactic sugar. The latest source code can be found as part of the desugar project. IntroductionPython has something called augmented arithmetic assignment. If you're not familiar with that phrase, it's basically when you do some … | Continue reading


@snarky.ca | 3 years ago

I will never fit in among C++ programmers (2013)

I have been actively programming in Python for nearly 13 years, ten of which have been spent as a core developer of the language itself. You could say I have an opinion when it comes to programming languages. That I have taken sides. That I am a programming language bigot. | Continue reading


@snarky.ca | 3 years ago

Unravelling binary arithmetic operations in Python

The reaction to my blog post on unravelling attribute access was positive enough that I'm inspired to do another post on how much of Python's syntax is actually just syntactic sugar. In this post I want to tackle binary arithmetic operations. Specifically, I want to unravel how s … | Continue reading


@snarky.ca | 3 years ago

Unravelling attribute access in Python

I wonder how many people realize that Python is has a lot of syntactic sugar? I'm not claiming it's like a Lisp-based language where the syntax is as bare bones as possible (although the Lisp comparison is not entirely unfounded), but much of Python's syntax isn't technically nee … | Continue reading


@snarky.ca | 3 years ago

Taking a month off from OSS volunteering (2016)

On October 1, 2016, I stopped volunteering for open source projects -- including Python -- for a month. While I still did open source work for Python as part of my job, I spent absolutely zero time helping any project outside of work (so no evenings, no weekends). This was | Continue reading


@snarky.ca | 3 years ago

What is the core of the Python programming language?

Why ask this question?It's no secret that I want a Python implementation for WebAssembly. It would not only get Python into the browser, but with the fact that both iOS and Android support running JavaScript as part of an app it would also get Python on to mobile. That | Continue reading


@snarky.ca | 3 years ago

Why I don't like SemVer anymore

Back in 2017 I wrote a blog post on how I manage version numbers. In that post I mentioned how I tried to follow semantic versioning. Over the subsequent 3 years I have come to the conclusion I actually don't like SemVer for my projects. It turns out I am | Continue reading


@snarky.ca | 3 years ago

The many ways to pass code to Python from the terminal

For the Python extension for VS Code, I wrote a simple script for generating our changelog (think Towncrier, but simpler, Markdown-specific, and tailored to our needs). As part of our release process we have a step where you are supposed to run python news which points Python at … | Continue reading


@snarky.ca | 3 years ago

Thoughts on where tools fit into a workflow

I am going to admit upfront that this is a thought piece, a brain dump, me thinking out loud. Do not assume there is a lesson here, nor some goal I have in mind. No, this blog post is providing me a place to write out what tools I use | Continue reading


@snarky.ca | 3 years ago

What the heck is pyproject.toml?

Recently on Twitter there was a maintainer of a Python project who had a couple of bugs filed against their project due to builds failing (this particular project doesn't provide wheels, only sdists). Eventually it came out that the project was using a pyproject.toml file because … | Continue reading


@snarky.ca | 4 years ago

A quick-and-dirty guide on how to install packages for Python

When people start learning Python, they often will come across a package they want to try and it will usually start with "just pip install it!" The problem with that advice is it's a very simplistic view of how to manage packages and can actually lead to problems down the | Continue reading


@snarky.ca | 4 years ago

Why you should use `python -m pip`

Fellow core developer and Canadian, Mariatta [https://twitter.com/mariatta],asked on Twitter about python -m pip and who told her about that idiom alongwith asking for a reference explaining it:> I learned sometime ago that we should be doing`python -m pip install ...` instead of … | Continue reading


@snarky.ca | 4 years ago

What it's like to be on the Python steering council

Someone emailed the steering council recently to ask what it was like to be onit, presumably because nominations will be opening next month[https://mail.python.org/archives/list/python-committers@python.org/thread/PLDUMAJOLHM5W6FWOMSGUBN2Q7Z6D3JM/]. Instead of sending a private r … | Continue reading


@snarky.ca | 4 years ago

A Primer on the Stellar Network

On September 10, 2019 while I was in London, UK at the Python core dev sprints,I got a message from a user named "spacedrop" [https://keybase.io/spacedrop] on Keybase [https://keybase.io/]. The message said I was being given 356.2904939XLM as a surprise gift of "free Lumens worth … | Continue reading


@snarky.ca | 4 years ago

How do you verify that PyPI can be trusted?

A co-worker of mine attended a technical talk about how Go's module mirror[https://proxy.golang.org/] works and he asked me whether there was somethingthere that Python should do.> Best technical talk that I've seen in a long time: @katie_hockman[https://twitter.com/katie_hockman … | Continue reading


@snarky.ca | 4 years ago

Podcast interviews where I talk about Python's governance

Over the past two months I have given two podcast interviews where I talk abouthow we handled Guido's retirement, chose our new governance model, and whatbeing on the inaugural steering council has been like.Now that I have "talked it out" at least twice I don't plan to blog abou … | Continue reading


@snarky.ca | 4 years ago

The challenges in designing a library for PEP 425 (aka wheel tags)

If you have  ever looked at a project that has a lot of wheels[https://www.python.org/dev/peps/pep-0427/] (like numpy[https://pypi.org/project/numpy/#files]), you may have wondered what the partthat comes after the project name and version mean. Well, they are known as platform … | Continue reading


@snarky.ca | 4 years ago

Deconstructing xkcd.com/1987/

On April 30, 2018, https://xkcd.com/1987/ got published. This wasn't the firsttime that Randall Munroe posted about Python (probably the most famous comic washis import antigravity one [https://xkcd.com/353/] which became an actualmodule in the stdlib as an easter egg), but it … | Continue reading


@snarky.ca | 5 years ago

An update on Python's governance

This post is meant to act as a summary of the current state of Python's governance as of the end of 2018. If you want to see an alternative take on what I present here, LWN has an article. What did Guido provide us? When discussing how the Python project | Continue reading


@snarky.ca | 5 years ago

Setting expectations for open source participation

(If you would prefer to watch a 30 minute talk on this same content, you can watch my Python US 2018 keynote) Who am I? [1] To start, I want to provide my bonafides so you know I'm not some crank spouting some armchair advice with nothing to back up | Continue reading


@snarky.ca | 5 years ago

An approach to lazy importing in Python 3.7

[Please note that the code in this blog post is now up on PyPI as part of the modutil library [https://pypi.org/project/modutil/]]One of the new features in Python 3.7[https://docs.python.org/3.7/whatsnew/3.7.html] is PEP 562[https://www.python.org/dev/peps/pep-0562/] which add … | Continue reading


@snarky.ca | 6 years ago

What are the most popular Docker images for Python?

There was a question at work about what the most popular Docker container imagefor running Python code was? I didn't have an answer, so I asked on Twitter tosee if a clear answer could be gleaned.The first poll [https://twitter.com/brettsky/status/925402634378395648] askedwhat p … | Continue reading


@snarky.ca | 6 years ago

A tutorial on packaging up your Python code for PyPI

On Wednesday, October 25th, I gave a workshop at PyLadies Vancouver[http://www.pyladies.com/locations/vancouver/] on how to package up your codeand put it up on PyPI [https://pypi.org/]. Since this workshop came about byrequest, I figured others out there who couldn't attend mig … | Continue reading


@snarky.ca | 6 years ago

How I manage package version numbers

I recently helped someone release their first project on PyPI and I was askedwhy I did version numbers the way I did, so I figured I would share where mycurrent thinking on the topic sits (this doesn't mean all of my projectscurrently follow this as my thoughts on this have chang … | Continue reading


@snarky.ca | 6 years ago

Why Competitive Marketplaces Aren’t Always the Best Solution

[This was meant to be a contribution to a book collecting chapters on varioustopics that would help "a programmer who has never been politically active, butis starting to wonder why so many things seem to be going from bad to worse".Unfortunately the book has fallen through, so I … | Continue reading


@snarky.ca | 6 years ago

Becoming an OSS project maintainer is about trust

To gain commit rights on CPython, a pre-existing core developer nominates yourfor commit rights to python-committers. That nominator lays out roughly why youshould be given commit rights, and then promises to watch your commits for alittle while to help you with any sharp edges y … | Continue reading


@snarky.ca | 6 years ago

Clarifying PEP 518 (a.k.a. pyproject.toml)

I was reading the latest issue of Pycoder's Weekly [http://pycoders.com/] andthey mentioned Thomas Kluyver's pull request[https://github.com/pypa/pip/pull/4144] to implement PEP 518[https://www.python.org/dev/peps/pep-0518/] in pip. The newsletter linked tothe reddit thread[ht … | Continue reading


@snarky.ca | 6 years ago

Designing an async API, from sans-I/O on up

While developing the CLA bot for CPython[https://github.com/python/the-knights-who-say-ni] (aka, the Knights Who SayNi), I decided to make it asynchronous, partially for performance reasons butalso because I simply wanted to. 😁 The problem with doing that for a GitHub bo … | Continue reading


@snarky.ca | 7 years ago

Customizing class creation in Python

When one thinks of ways of customizing classes at creation time, people probablytypically think of metaclasses and class decorators. Metaclasses are attypically viewed as the beginning of class creation while class decorators areat the end. But what you may not know is that ther … | Continue reading


@snarky.ca | 7 years ago

How to use your project & Travis to help test Python itself

One of the hardest parts of doing a new release of CPython is getting people totest it before the final release goes out. While CPython has a test suite and wetry to do our best to have good code coverage (currently sitting at above 83%[https://codecov.io/gh/python/cpython]), not … | Continue reading


@snarky.ca | 7 years ago

Don't just open the door, welcome people through it

During his PyCon US 2015 keynote, Guido stated that we "[wanted] at least twofemail core devs [https://youtu.be/G-uKNd5TSBw?t=13m40s]" by PyCon US 2016.Guido, Raymond Hettinger, and myself offered to help mentor women who wanted tobe core devs to help make this happen. It may not … | Continue reading


@snarky.ca | 7 years ago

My experience with type hints and mypy

The CLA bot for the PSF [https://github.com/python/the-knights-who-say-ni] isdesigned defensively because if the bot accidentally lets a pull request throughfrom someone that has not signed the CLA that could lead to legal troubles. Toalleviate any worries I may have about bugs … | Continue reading


@snarky.ca | 7 years ago

Looking for commonality among HTTP request APIs

It all started when ...While developing the CLA bot for Python[https://github.com/python/the-knights-who-say-ni] I realized this might not bethe last bot I or anyone else may have to write for helping with CPython'sdevelopment once it shifts to GitHub. As such, I began to think … | Continue reading


@snarky.ca | 7 years ago