The module shapes.py sets __all__. The program main.py imports from it with a star.
shapes.py:
__all__ = ["area", "_scale"]
_scale = 2
def area(s):
return s * s * _scale
def perimeter(s):
return 4 * s
main.py:
from shapes import *
print(area(3), _scale, "perimeter" in dir())
What does main.py print?
Log in to join the discussion.
Loading…