Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot
  1. Does not have to, but if the class is used by several other files/classes it should.
  2. It is a good practice see What does <if __name__=="__main__":> do? What does <if __name__=="__main__":> do?
  3. Python looks at $PYTHONPATH which is a list of directories to find modules in. You can put modules in subdirectories of one of these directories and import them with import directoryname.module.. You can import a class by from directoryname.module import ClassName.
  1. Does not have to, but if the class is used by several other files/classes it should.
  2. It is a good practice see What does <if __name__=="__main__":> do?
  3. Python looks at $PYTHONPATH which is a list of directories to find modules in. You can put modules in subdirectories of one of these directories and import them with import directoryname.module.. You can import a class by from directoryname.module import ClassName.
  1. Does not have to, but if the class is used by several other files/classes it should.
  2. It is a good practice see What does <if __name__=="__main__":> do?
  3. Python looks at $PYTHONPATH which is a list of directories to find modules in. You can put modules in subdirectories of one of these directories and import them with import directoryname.module.. You can import a class by from directoryname.module import ClassName.
Source Link
cforbish
  • 8.9k
  • 3
  • 32
  • 32
  1. Does not have to, but if the class is used by several other files/classes it should.
  2. It is a good practice see What does <if __name__=="__main__":> do?
  3. Python looks at $PYTHONPATH which is a list of directories to find modules in. You can put modules in subdirectories of one of these directories and import them with import directoryname.module.. You can import a class by from directoryname.module import ClassName.
lang-py

AltStyle によって変換されたページ (->オリジナル) /