I currently have:
tmp = myfunc()
mydict[mykey] = tmp
return tmp
..which seems a little too long. In javascript, I could just do:
return (mydict[mykey] = myfunc())
Is the above Python code the accepted way to do it, or is there something else?
edit: I'm aware of the possibility of doing:
mydict[mykey] = myfunc()
return mydict[mykey]
..but I wouldn't want to do a key lookup twice. Unless