Some globals are used in a python module:
ImFirst = 1
ImSecond = 2
AndImThird = "three"
globals() gives a dict of those names and values, but unfortunately it is not an OrderedDict (obviously, since globals() predates the collections module).
Is there a way to get the order in which the global names appear in the module?
Thanks to eryksun’s comment above, I dived into the ‘attributes tree’ of sys._getframe(),
and apparently all the global names, by order of appearance in code, exist in:
It also includes variables that are undefined, but joining this info with globals() does the trick.