Python Forum
function to store in caller's context
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function to store in caller's context
#1
i have a big block of code that sets up a couple dozen variables for later code to use. now i need to run this block 2 or 3 times. each time may or may not set individual variables. it might make sense to make the block be a function, but setting the variables doesn't happen in the caller's local name space. are there any workarounds or other ideas? this code is a project only i will use so the code doesn't need to be pythonic.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
function to store in caller's context - by Skaperen - Jul-24-2020, 09:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  exception context Skaperen 0 2,332 Mar-06-2021, 08:42 PM
Last Post: Skaperen
  in a function checking for caller errors Skaperen 3 2,295 Mar-04-2021, 05:00 AM
Last Post: Skaperen
  turning my function into a context manager Skaperen 2 1,975 Nov-14-2019, 09:08 PM
Last Post: Skaperen
  i want to make my own context manager Skaperen 0 1,675 Nov-10-2019, 05:21 AM
Last Post: Skaperen
  f-string for caller? Skaperen 2 1,993 Sep-16-2019, 07:47 PM
Last Post: Skaperen
  same context functions Skaperen 12 5,297 Jun-18-2019, 06:09 PM
Last Post: Skaperen
  Windows Context Menu Depth GWild 0 2,329 Jan-27-2018, 07:18 AM
Last Post: GWild

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020