Python: 'Private' module in a package

前端 未结 5 777
小蘑菇
小蘑菇 2020-12-05 06:23

I have a package mypack with modules mod_a and mod_b in it. I intend the the package itself and mod_a to be imported free

5条回答
  •  抹茶落季
    2020-12-05 06:48

    The solution I've settled on is to create a sub-package 'private' and place all the modules I wish to hide in there. This way they stay stowed away, leaving mypack's module list cleaner and easier to parse.

    To me, this doesn't look unpythonic either.

提交回复
热议问题