#NamedTuple
The task in question was "define a property on a NamedTuple". Somehow the Statistically Average Coder had generated the assertion that the property has to be patched onto the class after it's created.
December 30, 2025 at 10:11 PM
Python’s namedtuple() say hi
February 18, 2025 at 11:00 AM
🐍📺 Writing Clean, Pythonic Code With namedtuple [Video]

#python
Writing Clean, Pythonic Code With namedtuple
In this video course, you'll learn what Python's namedtuple is and how to use it in your code. You'll also learn about the main differences between named tuples and other data structures, such as dictionaries, data classes, and typed named tuples
realpython.com
July 13, 2025 at 2:00 AM
TIL about `copy.replace()` in Python 3.13

Trying to edit a NamedTuple or frozen dataclass in Python is much simpler now: there's a new `__replace__` method on them, and the right API to use it is:

>>> v
Vector(x=1, y=2)
>>> import copy
>>> copy.replace(v, x=3)
Vector(x=3, y=2)
December 22, 2024 at 10:31 AM
TIL about Python 3.13's cute copy.replace() for creating modified copies of immutable (not only, but for them it's super convenient) types.

Point = namedtuple('Point', ['x', 'y', 'z'])
p0 = Point(x=0, y=50, z=10)
p1 = copy.replace(p0, x=5)

You can override __replace__ in your custom class too!
October 28, 2025 at 5:56 PM
Named Tuples in Python:
A named tuple lets you create lightweight, immutable objects with named fields for better readability and access than regular tuples.
#Python #PythonTips #NamedTuple #CodingTips #LearnPython #PythonDeveloper #CodeSmarter #100DaysOfCode #PythonHack #TechTip
June 27, 2025 at 9:00 PM
🐍📰 Write Pythonic and Clean Code With namedtuple

Discover how Python's namedtuple lets you create simple, readable data structures with named fields you can access using dot notation.

buff.ly/RoxwgVq
June 18, 2025 at 12:58 PM
But if you want to use something that can count the number of Fire/water/wind, consider a namedtuple from the collections library:
from collections import namedtuple
Spell = namedtuple(“Spell”, (“Earth”,”Fire”,”Water”))
PlayerSpell = Spell()
PlayerSpell[“Fire”] = ask(“How much fire?”)
February 18, 2025 at 5:46 AM
Or use a NamedTuple or dataclass
December 23, 2023 at 2:21 AM
Functional code allows for this to become driven by a simple NamedTuple which makes this super easy to test and simple to define the state that each parameter should exist in.
November 23, 2024 at 12:09 AM
NamedTuple tbm da certo ... Mas dataclass / pydantic é melhor pq é + strict realmente
September 14, 2025 at 11:28 PM
🐍📰 Write Pythonic and Clean Code With namedtuple

Learn how Python's namedtuple allows you to create clear, accessible data structures with named fields that can be accessed using dot notation.

buff.ly/RoxwgVq
June 21, 2025 at 9:21 PM
zenn.dev/ncdc/article...

「ライブラリの仕様を読まず勝手な解釈で誤った使い方をするのをやめたほうが良さそう」
かちゃ
Pythonで型定義にNamedTupleを使うのはやめたほうが良さそう
zenn.dev
May 16, 2025 at 9:59 AM
namedtupleはtupleの拡張で、tupleと互換性があるかちゃ。つまり比較などで参照されるのはtupleが持つ属性であってnamedtupleで定義した型の情報ではないかちゃ
May 16, 2025 at 10:01 AM
How I wish Python import syntax were:

import numpy as np
import typing.(NamedTuple, Tuple)

How Python import syntax is:

import numpy as np
from typing import NamedTuple, Tuple
October 31, 2024 at 3:05 PM
Oh yes! Named tuples are like promises that went to business school 🎓

from collections import namedtuple
Person = namedtuple('Person', ['name', 'age'])
me = Person('Bob', 25)

They're what regular tuples become after watching too many TED talks about self-improvement 😄
December 31, 2024 at 12:14 PM
C++ can be so readable
March 25, 2026 at 6:58 PM
Day 12 of #AdventOfCode2024, I originally was about to use dataclasses, but ended up using just dict and NamedTuple again.

The Point class I made several days ago keep being used again and again, though.

Maybe I should put that into a separate module?

#PythonProgramming
#AdventOfCode
December 17, 2024 at 11:04 AM
Thanks to Guo Yubin Chimney now supports NamedTuples!

Grab it at:
- github.com/scalalandio/...
- github.com/scalalandio/...
Release v1.9.0 · scalalandio/chimney
Changelog: Add supports for NamedTuple (#766). by @ETCHKILI in #852
github.com
March 10, 2026 at 9:50 AM
qiita.com/Seny/items/a...
残念。遅いのか。まあ、classだからな。
組み込みにclass使うと明らかに遅くなるもんなぁ。以前機械学習器(動くことすらしないやつ(汗))のリファクターでclass使ってきれいに書き直したら遅くなったような気がして、詳しそうな人に聞いてみた事があるんだけど、特に考えたことはなさそうだった。でも、やっぱ気のせいじゃなかったぽ。
今でもclassは使っちゃうけど…。見やすいし、引数のバケツリレーしなくて済むから楽なんだよね。組み込みみたいなリアルタイム性までは要求されないし。
データに関しては、素直に辞書のままで行くか。
namedtupleで美しいpythonを書く!(翻訳) - Qiita
namedtupleの解説記事です。この記事の想定読者namedtupleの基本を知りたい人namedtupleの存在意義がよく分からない人namedtupleの活用場面を知りたい人そこそ…
qiita.com
February 18, 2025 at 4:29 PM
❓🐍 Quiz: Using Data Classes in Python Quiz realpython.com/quizzes/data...
Using Data Classes in Python Quiz – Real Python
Test your knowledge of Python data classes, namedtuple, immutability, auto-generated methods, inheritance, and slots.
realpython.com
March 25, 2026 at 12:04 PM
Gotta have grace for my homies, because periodically I'm like "wow instead of making a whole new class I could just make a NamedTuple with an alternate constructor method or two," and before you know it I've made A Whole New Class But Worse

beam-eyed mfs ain't to step to their mote-eyed tovarishes
October 31, 2024 at 11:48 AM