3 ms·
I'm not sure if people realize that python allows dictionaries to have integer keys. This is syntactically valid python code: def sum(a, b): return a
by TrianguloY 3y ago
I'm not sure if people realize that python allows dictionaries to have integer keys. This is syntactically valid python code:
def sum(a, b):
return a + b
d={0:5, 1:9}
sum(**d)
But it throws a TypeError: sum() keywords must be strings.
Also, it's interesting to see a lot of people saying that this is too "black magic" for python, when python is probably one of the languages with the most black magic I've seen. In fact, I'm sure that with maybe just a single call to a helper function you can simulate this new feature thanks to the python black magic...