Python Forum
exec() instead of functions
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exec() instead of functions
#4
You could perhaps write all the config code in a function and return a copy of the locals(), as an alternative to exec
def my_config(param):
    spam = 'eggs' + param
    ham = 'bacon' * 10
    return dict(locals())
Reply


Messages In This Thread
exec() instead of functions - by Skaperen - Aug-01-2020, 05:37 AM
RE: exec() instead of functions - by Gribouillis - Aug-01-2020, 09:54 AM
RE: exec() instead of functions - by Skaperen - Aug-02-2020, 10:37 PM
RE: exec() instead of functions - by Gribouillis - Aug-02-2020, 10:53 PM
RE: exec() instead of functions - by Skaperen - Aug-03-2020, 10:29 AM
RE: exec() instead of functions - by Gribouillis - Aug-03-2020, 11:12 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  documentation is wrong for exec() Skaperen 9 3,511 Jul-28-2019, 02:49 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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