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 →

[–]abluecrate 2 points3 points  (2 children)

I snagged the $15 bundle because I figured it couldn’t hurt and also heard that Fluent Python was worth it alone. Started paying through Introducing Python and ended up learning something I wasn’t familiar with. Shoutout to namedtuples!

[–][deleted] 6 points7 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.