This is a Python convention to indicate the file is not part of the public interface of the module. An example could be _mixins.py for a mixins class (this is used in pandas for example).
When doing a "from package import *" any file with an underscore is not imported, respecting this convention.
Sometimes an underscore can also be used to prevent name collisions e.g. implementing some JSON helpers in _json.py to avoid conflict with another json.py (pandas has this file too).
Pat yourself on the back if you have debugged into an underscore-prefixed file - you have ventured into the hidden depths of a package's implementation details. Good Job!
No comments:
Post a Comment