←back to thread

191 points jwilk | 1 comments | | HN request time: 0.383s | source
Show context
sundarurfriend ◴[] No.46230418[source]
Can someone ELI5 the core difference between this and named tuples, for someone who is not deep into Python? ChatGPT's answer boiled down to: unordered (this) vs ordered (NTs), "arbitrary keys, decided at runtime" vs "fixed set of fields decided at definition time" (can't an NT's keys also be interpolated from runtime values?), and a different API (`.keys()`, `.items()`), etc (I'm just giving this as context btw, no idea if there's inaccuracies in these).

So could this also have been approached from the other side, as in making unordered NamedTuples with support for the Mapping API? The line between dictionaries and named tuples and structs (across various languages) has always seemed a bit blurry to me, so I'm trying to get a better picture of it all through this.

replies(5): >>46230459 #>>46230674 #>>46230747 #>>46230783 #>>46237202 #
grimgrin ◴[] No.46230459[source]
I think you could have asked this same comment w/o mentioning ChatGPT and you wouldn't have been downvoted to oblivion in 3 minutes

I don't see anything wrong with your asking to understand

replies(1): >>46230803 #
chistev ◴[] No.46230803[source]
This place hates ChatGPT and AI. Lol.

Edit: Of course, I get down voted as I predicted I would. Lol.

replies(2): >>46230834 #>>46232406 #
1. grimgrin ◴[] No.46232406[source]
you made a non-comment, that's why you're downvoted

comments don't have to be substantial, but they should be adding something that might merit more responses, or could. yours does not. what kind of reply could you even give to "this place [and so, its users] hates [thing]"

I'd ask you to qualify it, but you can't really qualify such a statement