Python modules with identical names (i.e., reusing standard module names in packages)

后端 未结 4 1116
死守一世寂寞
死守一世寂寞 2020-12-03 07:38

Suppose I have a package that contains modules:

SWS/
  __init.py__
  foo.py
  bar.py
  time.py

and the modules need to refer to functions c

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 08:17

    As others have said, this is generally a bad idea.

    That being said, if you're looking for potential workarounds, or a better understanding of the problem, I suggest you read the following SO questions:

    • Importing from builtin library when module with same name exists

    • How to access a standard-library module in Python when there is a local module with the same name?

提交回复
热议问题