I want to do something like this:
parsetable = {
# ...
declarations: {
token: 3 for token in [_id, _if, _while, _lbrace, _println]
}.update({_variable: 2}),
#...
}
However this doesn't work because update doesn't return anything. Is there any easy way to do this besides writing the entire dict explicitly?
It should be possible using dict() and a list comprehension of tuples + the extra part, but that is awkward.