Tag view

#modules

Cross-subject tag search for related interview cards.

Clear

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

Tagged with modules

3 cards

Python Medium Theory

Modules, imports, aliasing, and the module search path

Python resolves imports through its module search path, and you can import names directly or alias modules for readability.

  • `import x` and `from x import y` behave differently
  • Aliases like `import numpy as np` are common
  • Search path includes the current project and installed packages

Modules, imports, aliasing, and the module search path

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

JavaScript Medium Theory

Modules in JavaScript: import/export, default export, named export, and CommonJS vs ES modules

Modern JavaScript uses modules to organize code, with ES modules in the language standard and CommonJS still common in older Node.js code.

  • Named and default exports behave differently
  • ES modules use `import` and `export`
  • CommonJS uses `require` and `module.exports`

Modules in JavaScript: import/export, default export, named export, and CommonJS vs ES modules