Let's talk about Python metaclasses. 🎩✨ Many think they are magical things that mere mortals should never use. That's not quite true, although in many cases metaclasses can needlessly complicate things. Beware.
Read the thread! 👇👇👇
Note: the purpose of this thread is to show how to use metaclasses via a few examples. There are a few simplifications here and there for the sake of brevity. If you want to understand how things work I suggest to start with the official documentation: docs.python.org/3/reference/da…
Jan 29, 2019 • 19 tweets • 5 min read
Let's talk about immutability. Python, unlike languages like Clojure, Erlang, and Rust is built entirely around mutable state. I'm going to try to convince you that immutability is awesome and can be effectively used in Python today.
Thread 👇
1. If an object is immutable it means that its state cannot be changed after it is created. For instance, in Python you can't change a character in a string, or reassign an element of a tuple. Python ships with a few immutable datatypes: str, bytes, tuple/namedtuple, frozenset.