Oct-26-2021, 05:40 PM
i have 2 dictionary expressions. i want to combine them into one so that the one has each item from both. if one is already in a variable i can use .update() on that variable. but both dictionaries are expressions that are comprehensions. if the | operator could be used for dictionaries like it can for sets then i could do something like:
(warning: invalid code)
IMHO: every operation for sets should be allowed on dictionary keys and work the same way.
(warning: invalid code)
fun( {foo(x):x for x in range(256)} | {bar(x):x for x in range(256)} )but i am unable to come up with a way to do this without forming the dictionary in another variable using more than one line of code. i want to have it all in one comprehension.
IMHO: every operation for sets should be allowed on dictionary keys and work the same way.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.