This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ethan.furman
Recipients barry, ethan.furman, martin.panter
Date 2016-03-25.00:14:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Not a fan.  :/

How about getting your own copy of the public decorator initialized with the globals you pass in?

class Public:
    def __init__(self, module):
        module should be the globals() dict from the calling module
        self.module = module
        self.module.setdefault('__all__', [])
    def __call__(self, thing, value=None):
        if isinstance(thing, str):
            self.module[thing] = value
            self.module[thing.__name__] = thing

and in use:

public = Public(globals())

def baz(a, b):
    #blah blah

public('CONST1', 2)
Date User Action Args
2016-03-25 00:14:52ethan.furmansetrecipients: + ethan.furman, barry, martin.panter
2016-03-25 00:14:52ethan.furmansetmessageid: <>
2016-03-25 00:14:52ethan.furmanlinkissue26632 messages
2016-03-25 00:14:52ethan.furmancreate