Contribute Media
A thank you to everyone who makes this possible: Read More

The Craziest fn Thing I've Ever Seen (and It Lives in CPython!!!)

Description

I am enamored with dataclasses. I love them in Python, I love them in Kotlin. A while back I was looking for a Kotlin dataclass feature in Python, and was disappointed to find it wasn't there. I went digging into the CPython source code to see if it could be added and found the craziest function I'd ever seen, _create_fn, and it's used everywhere in the dataclass implementation!

Join me as I shared what I found out about my dear dataclasses, and get a better understand of decorators and metaprogramming in Python!

Details

Improve this page