Aug-14-2019, 04:23 AM
i have a thread function with a role of handling some commands it gets from a queue. there a lot of statement groups like:
any ideas?
elif msg[0] == 'some command name': ... # statements to handle that command ...i was thinking of having a mapping of function references but every command involves accessing and modifying local variables, so the functions aspect of this just makes things worse with all the detail to exchange data with the caller (passing locals() is not an option because modifications can't be done that way). if there was a way to run a function in the same context as the caller, that would be a nice direct solution. even calling exec() with the code in a string because passing locals() is still a dictionary that can't be modified.
any ideas?
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.