Use a with block to control export (public/private/__all__)
Discussions on Python.org
Use a with block to control export (public/private/__all__)
Presently, there is a lot of debate about how to do export control. An alternative suggestion is an export context manager that remains compatible with __all__: with export(): # Everything declared inside export blocks is exported. import math import sys as sys_alias CONST = 42 def not_exported(): pass # Outside block, not exported with export(): # Second block. def func(): return CONST print(func()) # You can put a non-declaration statement inside, but bad style! pr...
Presently, there is a lot of debate about how to do export control. An alternative suggestion is an export context manager that remains compatible with __all__: with export(): #…
0 comments
No comments yet.