N is for namedtuple - Python A to Z 0 ▲ Juha-Matti Santala In reply to: Python: fix TypeError: NamedTuple() got an unexpected keyword argument · Adam Johnson 95 days ago · Tech · hide · Fediverse post Python A-Z is a blog series about Python. Each day, I share insights, ideas and examples for different parts of Python development that match with the letter of the day. Blaugust is an annual blogging festival in August where the goal is to write a blog post every day of the month. If you write any Python code, you should be using more namedtuples than you are using right now. They are my favourite data structure in Python: they are a subclass of tuples so they are immutable but in addition, you give them and their fields names which increases the readability and debuggability of your code a lot. I have raved about them before: in Batteries included in 2024 as well as every year when writing about Advent of Code. You should read the earlier post for more reasons for why to use them. For the second time this month, I’ll link to Raymond Hettinger’s great talks, this time to his Beyond PEP 8 talk from PyCon 2015 where in addition to a bunch of other good tips, briefly talks about why… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town