TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Just Use Dictionaries (Python)

6 pointsby david-j-vujicover 1 year ago

4 comments

sametmaxover 1 year ago
I used to be a strong proponent of this, but I tend to use dataclasses more and more with time. Still use a lot of dicts, lists, and sets, but mostly as collections, rarely to hold one single element data.<p>It came naturally, not out of some design, but I guess having better and better typing support everywhere makes it more and more convenient.
评论 #37372196 未加载
jstx1over 1 year ago
I like the simplicity but there are some social problems with this. Let&#x27;s say that I work on a team which has codebases with classes&#x2F;dataclasses and I add a new codebase that doesn&#x27;t use them, or one that doesn&#x27;t _underscore just about everything - the first thing that will come up in the code review is questions about why I&#x27;m doing things differently, and I wouldn&#x27;t have a good reason apart from the fact that I find it more aesthetically pleasing.
评论 #37372141 未加载
chrisjjover 1 year ago
&gt; A Python dictionary has a simple &amp; well-known API.<p>Actually it doesn&#x27;t.
评论 #37370265 未加载
JoeyBananasover 1 year ago
Except when you need Pandas dataframes or Apache Arrows
评论 #37377579 未加载