Let’s try a non-trivial example of a binding: Minuit2 (6.14.0 standalone edition).
[Read More]Binding Minuit2
Posted on July 7, 2018 (Last modified on June 9, 2026) | Henry Schreiner
Let’s try a non-trivial example of a binding: Minuit2 (6.14.0 standalone edition).
[Read More]This was originally given as a PyHEP 2018 talk. It is designed to be interactive, and can be run in SWAN if you have a CERN account. If you want to run it manually, just download the repository: github.com/henryiii/pybindings_cc. It is easy to run in Anaconda.
[Read More]About ten years ago, Guido Van Rossum, the Python author and Benevolent Dictator for Life (BDFL), along with the Python community, decided to make several concurrent backward incompatible changes to Python 2.5 and release a new version, Python 3.0.
[Read More]This is a simple explanation of the asyncio module and new supporting language
features in Python 3.5. Even though the new keywords async and await are new
language constructs, they are mostly1 useless without an event loop, and that
is supplied in the standard library as asyncio. Also, you need awaitable
functions, which are only supplied by asyncio (or in the growing set of async
libraries, like asyncssh, quamash etc.).
This is a simple example to show how Asyncio works without using Asyncio itself, instead using a basic and poorly written event loop. This is only meant to give a flavor of what Asyncio does behind the curtains. I’m avoiding most details of the library design, like callbacks, just to keep this simple. Since this is written as an illustration, rather than real code, I’m going to dispense with trying to keep it 2.7 compatible.
[Read More]Slots seem to be poorly documented. What they do is simple, but whether they are used is tricky. This is a little mini-post on slots.
[Read More]This is a quick tutorial over the basics of what metaclasses do.
Metaclasses, while seemingly a complex topic, really just do something very simple. They control what happens when you have code that turns into a class object. The normal place they are executed is right after the class statement. Let’s see that in action by using print as our metaclass.
[Read More]I haven’t seen a great deal of practical documentation about using classmethods as factories in Python (which is arguably the most important use of a classmethod, IMO). This post hopes to fill in that gap.
[Read More]