/top/
/new/
/best/
/ask/
/show/
/job/
^
slacker news
login
about
←back to thread
Dict Unpacking in Python
(github.com)
101 points
_ZeD_
| 2 comments |
08 Jul 25 16:05 UTC
|
HN request time: 0.001s
|
source
Show context
nikisweeting
◴[
12 Jul 25 04:08 UTC
]
No.
44539220
[source]
▶
>>44501287 (OP)
#
I would donate $500 to the PSF tomorrow if they added this, the lack of it is daily pain
replies(3):
>>44539245
#
>>44540127
#
>>44540364
#
1.
IshKebab
◴[
12 Jul 25 07:42 UTC
]
No.
44540127
[source]
▶
>>44539220
#
You shouldn't be using dicts for data that you know the name of anyway - use dataclasses or named tuples. Dicts are best for things with keys that are not known at compile time.
replies(1):
>>44541834
#
ID:
GO
2.
IgorPartola
◴[
12 Jul 25 13:10 UTC
]
No.
44541834
[source]
▶
>>44540127 (TP)
#
Since when can you use data classes for kwargs? There are plenty of times when you should use a dict even if you know the keys.
↑