Tag view

#packages

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with packages

1 card

Python Medium Theory

The `__name__` guard, package structure, and relative vs absolute imports

The `if __name__ == "__main__"` guard separates script execution from import behavior, and package imports can be relative or absolute depending on context.

  • `__name__` changes when imported
  • Absolute imports are usually clearer
  • Relative imports are useful inside packages

The `__name__` guard, package structure, and relative vs absolute imports