Jun-23-2024, 01:54 AM
i have the understanding that a function can access the globals() namespace on its own. of course, if the function is defined to have it passed, the caller could fake it by creating a dictionary (maybe populating it) and passing that, instead of globals().
the kind of use cases i was considering is where the main code is doing a variety of different variable settings, then for each place doing the same exact calculations that need to work with local variables (including setting some). many time capture a block of code (^u4^k^y in emacs, to capture 4 lines) and drop it (^y in emacs, in each place) in a few other places. those 4 lines modify 4 local variables. i do not want a function to be trying to pass a tuple or dict back. i prefer to keep it all simple. i might like to have a "deflocal" feature that defines a function that shares the locals() namespace with the code that defines it and calls it.
the kind of use cases i was considering is where the main code is doing a variety of different variable settings, then for each place doing the same exact calculations that need to work with local variables (including setting some). many time capture a block of code (^u4^k^y in emacs, to capture 4 lines) and drop it (^y in emacs, in each place) in a few other places. those 4 lines modify 4 local variables. i do not want a function to be trying to pass a tuple or dict back. i prefer to keep it all simple. i might like to have a "deflocal" feature that defines a function that shares the locals() namespace with the code that defines it and calls it.
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.