โ† All POC Flashcard Decks

Implementation & Configuration Flashcards

7 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Implementation & Configuration flashcards as text
  1. What is the primary advantage of using `pathlib.Path` over `os.path` for file system operations in Python 3?

    Answer: pathlib provides an object-oriented API that is more readable and composable

    `pathlib.Path` represents paths as objects with methods like `.read_text()` and `/` operator joining, making code more readable than string-based `os.path` functions.

  2. Which `logging` level is the lowest severity in Python's standard logging hierarchy?

    Answer: DEBUG

    DEBUG (level 10) is the lowest named severity level; messages at this level are the most verbose and granular.

  3. What does `if __name__ == '__main__':` guard protect against?

    Answer: Running top-level code when the module is imported by another module

    When a module is imported, `__name__` is set to the module name rather than `'__main__'`, so guarded code only runs when the file is executed directly.

  4. In a `setup.cfg` file, which section declares the package's minimum Python version requirement?

    Answer: [options] python_requires

    The `python_requires` key under the `[options]` section in `setup.cfg` specifies the compatible Python version range (e.g., `>=3.8`).

  5. What is the effect of creating a `.pth` file inside a `site-packages` directory?

    Answer: Each line in the file is added to `sys.path` at interpreter startup

    Python processes `.pth` files in `site-packages` at startup, adding each directory listed on a line to `sys.path`.

  6. Which tool is the recommended modern replacement for `setup.py` to build and publish Python packages?

    Answer: build + twine

    The `build` package creates distributions and `twine` uploads them to PyPI, replacing `python setup.py sdist bdist_wheel upload`.

  7. What does `pip install package[extra]` syntax do?

    Answer: Installs the package along with its optional 'extra' dependency group

    Extras (defined via `extras_require` in setup.py) allow packages to declare optional dependency groups installable on demand with bracket syntax.