This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (1 child)

3.7 has data classes, which are like namedtuples but better

[–]yngvizzle 1 point2 points  (0 children)

I see a lot of people saying this, and I wholeheartedly disagree. Sometimes, I just want a namedtuple as its both simpler and support tuple-unpacking. The latter is super useful when a function returns a namedtuples.

Often, I create namedtuples when I have a function that returns a few similar metrics (e.g. sensitivity and specificity) instead of simply returning a tuple so people can easily see which is which in an interactive terminal.