[Python-ideas] Proposal for special name and qualname symbols
Ethan Furman
ethan at stoneleaf.us
Wed Jun 8 19:58:47 EDT 2016
On 06/08/2016 04:28 PM, Barry Warsaw wrote:
> On Jun 08, 2016, at 10:57 PM, Michael Selik wrote:
> The issue in this context is that @public as a decorator only works for things
> with an __name__, e.g. functions and classes. There have been different
> proposals to make it work for constants, and my approach supports calling
> public() with keyword arguments, e.g.
>
> public(SEVEN=7)
> public(a_bar=Bar())
>
> Admittedly this is rather un-Pythonic since it not only modifies the module's
> __all__ but it pokes a variable binding into the module globals. It's yucky
> and I'd rather be able to do something like:
>
> @public
> SEVEN = 7
>
> @public
> a_bar = Bar()
>
> Thus the relevance to this thread.
How would those examples look if we had the __LHS__ working?
--
~Ethan~
More information about the Python-ideas
mailing list