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
Date 2016-03-24.02:48:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1458787688.43.0.0467845359815.issue26632@psf.upfronthosting.co.za>
In-reply-to
Content
def public(thing, value=None):
    if isinstance(thing, str):
        mdict = sys._getframe(1).f_globals
        name = thing
        mdict[name] = thing  # no need for retyping! ;)
    else:
        mdict = sys.modules[thing.__module__].__dict__
        name = thing.__name__
    dunder_all = mdict.setdefault('__all__', [])
    dunder_all.append(name)
    return thing

@public
def baz(a, b):
    return a+ b

public('CONST1', 3)

CONST2 = 4

----------------------------

On the down side, you know somebody is going to @public a class' method -- how do we check for that?
History
Date User Action Args
2016-03-24 02:48:08ethan.furmansetrecipients: + ethan.furman, barry
2016-03-24 02:48:08ethan.furmansetmessageid: <1458787688.43.0.0467845359815.issue26632@psf.upfronthosting.co.za>
2016-03-24 02:48:08ethan.furmanlinkissue26632 messages
2016-03-24 02:48:08ethan.furmancreate