3 ms·
I use the Python package 'sorcery' [0] in all my production services. It gives dict unpacking but also a shorthand dict creation like this: from sorcery i
by yde_java 1y ago
I use the Python package 'sorcery' [0] in all my production services.
It gives dict unpacking but also a shorthand dict creation like this:
from sorcery import dict_of, unpack_keys
a, b = unpack_keys({'a': 1, 'b': 42})
assert a == 1
assert b == 42
assert dict_of(a, b) == {'a': 1, 'b': 42}
[0] https://github.com/alexmojaki/sorcery https://github.com/alexmojaki/sorcery
- john-radio 1y agoThat seems a bit crazy and like it would lead to unpredictable and hard-to-mantain code. (pardon my candor).
- rrishi 1y agoim curios why you think so ?