Modules, Libraries & Debugging 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 Modules, Libraries & Debugging flashcards as text
What is the role of `pip install -e .` when developing a Python package?
Answer: Installs the package in editable (development) mode so source changes take effect immediately
The `-e` flag installs the package as a symbolic link to the source directory, so edits are reflected instantly.
Which `traceback` module function prints the current exception's traceback to stderr?
Answer: traceback.print_exc()
`traceback.print_exc()` prints the traceback of the currently handled exception, mimicking Python's default error output.
In `re` module regex, what does the flag `re.IGNORECASE` (or `re.I`) do?
Answer: Makes the match case-insensitive
`re.IGNORECASE` makes pattern matching treat uppercase and lowercase letters as equivalent.
Which `datetime` method returns the current local date and time?
Answer: datetime.datetime.now()
`datetime.datetime.now()` returns a `datetime` object representing the current local date and time.
What does `assert x == 5, 'x must be 5'` do when `x` is 3?
Answer: Raises an AssertionError with the message 'x must be 5'
When the assertion expression is False, Python raises `AssertionError` with the optional message provided.
Which `itertools` function produces an infinite sequence of evenly spaced values?
Answer: itertools.count()
`itertools.count(start, step)` yields start, start+step, start+2*step, … indefinitely.
What problem does using a virtual environment (`venv`) solve?
Answer: Isolates project dependencies to avoid version conflicts between projects
A virtual environment creates an isolated Python installation so each project can have its own dependency versions.