syntactic sugar Unravelling `for` statements As part of my series on Python's syntactic sugar, I am going to cover the for statement. As usual, I will be diving into CPython's C code, but understanding or even reading those parts of this post won't be required in order to understand
syntactic sugar Unravelling assertions In this post, as part of my series on Python's syntactic sugar, I'm going to cover assert statements. Now, the actual unravelling of the syntax for assert a, b is already given to us by the language reference: if __debug__: if not a: raise
syntactic sugar 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
syntactic sugar 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
syntactic sugar 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
syntactic sugar 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
syntactic sugar 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.
syntactic sugar 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
syntactic sugar 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
syntactic sugar 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
syntactic sugar Unravelling binary arithmetic operations in Python [This post has been updated multiple times since it's initial posting; see the Corrections section at the end for what was changed.] The reaction to my blog post on unravelling attribute access was positive enough that I'm inspired to do another post on how
syntactic sugar Unravelling attribute access in Python I wonder how many people realize that Python 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
Python 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
project management 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
Python 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
project management 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
packaging 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
packaging 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
packaging Why you should use `python -m pip` Fellow core developer and Canadian, Mariatta, asked on Twitter about python -m pip and who told her about that idiom along with asking for a reference explaining it: I learned sometime ago that we should be doing `python -m pip install ...` instead of simply
open source 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 on it, presumably because nominations will be opening next month. Instead of sending a private response I figured I would write a blog post instead so others could know what
A Primer on the Stellar Network [Updated 2019-11-17] 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" on Keybase. The message said I was being given 356.2904939 XLM as a surprise gift of
packaging How do you verify that PyPI can be trusted? A co-worker of mine attended a technical talk about how Go's module mirror works and he asked me whether there was something there that Python should do. Best technical talk that I've seen in a long time: @katie_hockman on Go Module
open source Podcast interviews where I talk about Python's governance Over the past two months I have given two podcast interviews where I talk about how we handled Guido's retirement, chose our new governance model, and what being on the inaugural steering council has been like. Now that I have "talked it out" at
packaging 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 (like numpy), you may have wondered what the part that comes after the project name and version mean. Well, they are known as platform compatibility tags and they are primarily
Python Deconstructing xkcd.com/1987/ On April 30, 2018, https://xkcd.com/1987/ got published. This wasn't the first time that Randall Munroe posted about Python (probably the most famous comic was his import antigravity