I am using a large list of variables inside some definitions and classes (mainly because I want to be able to use the code-folding feature of pydev). Is there any constructor I can use on a definition or class to make its variables automatically considered globals?
This is an example of what I did after following some of the recommendations provided on the comments:
From:
img_globe = os.path.join(set_img_dir, 'img_globe.png')
img_help = os.path.join(set_img_dir, 'img_help.png')
img_exit = os.path.join(set_img_dir, 'img_exit.png')
img_open = os.path.join(set_img_dir, 'img_open.png')
img_tutorial = os.path.join(set_img_dir, 'img_tutorial.png')
img_save = os.path.join(set_img_dir, 'img_save.png')
img_site = os.path.join(set_img_dir, 'img_site.png')
... (long, long list)
To:
varies = {}
dirList=os.listdir(set_img_dir)
for fname in dirList:
varies[fname.split(".")[0]] = os.path.join(set_img_dir, fname)