This is the first in a series of articles that will look at new features introduced in Python 3.7. I don’t know about anyone else, but I tend only to discover new language features by chance when I come across them on StackOverflow or whatever. I figure a more deliberate process of reading the docs […]
This post will dig into what happens when a new class is created, at a bytecode level. This isn’t too interesting on its own, but one of my other posts that’s in the works has ended up being far too long, and so I’m breaking this out as a chunk that I can refer to. […]
Python is a regular language, which means that function definitions, class definitions, import statements etc. mostly work at any scope. But there’s an exception for “
from ... import *“, which can’t be used inside a function. The reason why turns out to reveal something interesting about the internals of Python.
In future posts I want to delve into some of the internals of Python, and in order to demonstrate what’s going on I’m going to be taking apart some bytecode. In this post I’ll go over some of the basics, so if you’ve never looked at Python bytecode before this is the place to start.