[Python-ideas] Proposal for special name and qualname symbols

MRAB python at mrabarnett.plus.com
Wed Jun 8 22:29:07 EDT 2016


On 2016-06-09 00:28, Barry Warsaw wrote:
> On Jun 08, 2016, at 10:57 PM, Michael Selik wrote:
>
>>3. @public for constants (as per Barry's email)
>>
>>I don't know what that last one was referring to. Do you mind clarifying,
>>Barry (or anyone else)?
>
> Sure!
>
> I propose that it's difficult to keep __all__ up to date.  Witness the
> plethora of bugs open on similar issues in the stdlib.  Furthermore, the
> definition of __all__ is usually far removed from the object it names.  And
> it's not obvious when looking at the object whether it is intended to be
> exported or not.
>
> @public solves these problems and I contend that its meaning is pretty
> obvious, given that (unknown to me at the time) there have been at least two
> other independent inventions of nearly exactly the same decorator.
>
[snip]

A workaround is to use a comment:

#@public
SEVEN = 7

and a script that parses the file and updates the __all__.



More information about the Python-ideas mailing list