Guance Learn

Observability questions

Focused answers for definitions, architecture choices, troubleshooting, pricing, and evaluation.

Illustration of Git branches and version history
Technical guide

Create a .gitignore file

Write and share Git ignore rules, check which patterns match, and keep exceptions working without accidentally treating inline comments as patterns.

Python programming and application logging
Explainer

Create nested directories in Python

Create missing parent directories with pathlib or os.makedirs, tolerate existing directories, and understand permissions, races, and path conflicts.

Python programming and application logging
Explainer

Build a Python dictionary from two lists

Combine keys and values with dict and zip, reject mismatched lengths, handle duplicate keys, and avoid unexpected keys when filling missing values.

Python programming and application logging
Explainer

Implement a singleton in Python

Compare module-level instances, metaclass caching, and __new__ in Python, including repeated initialization, thread safety, and testing trade-offs.

Python programming and application logging
Explainer

Debug pytest tests with pdb and breakpoints

Set a breakpoint in a pytest test or enter pdb on failure, inspect variables, and understand capture behavior and PYTHONBREAKPOINT.

Python programming and application logging
Explainer

Define custom exceptions in Python

Create application exceptions from Exception or a specific built-in type, preserve normal exception behavior, and expose structured error details.

Python programming and application logging
Explainer

Delete items from a Python dictionary

Use del, pop, or popitem to remove dictionary entries, choose missing-key behavior, and delete several keys without mutating an active iteration.

Python programming and application logging
Explainer

Delete files and directories in Python

Choose unlink, rmdir, or shutil.rmtree for the correct target, handle missing paths and symlinks, and understand when deletion bypasses the trash.

Illustration of Git branches and version history
Technical guide

Delete a Git branch locally and on the remote

Delete local and remote branch refs separately, prune stale tracking refs, and check merge status and worktrees before removing a branch.

Illustration of Git branches and version history
Technical guide

Split a subdirectory into a separate Git repository

Extract a directory and its relevant history with git-filter-repo or subtree split, then publish the new repository and update its dependencies.

Python programming and application logging
Explainer

Determine an object’s type in Python

Use type for exact classes, isinstance for inheritance-aware checks, and issubclass for classes. Check supported operations directly when type is not the requirement.

Illustration of Git branches and version history
Technical guide

Find the remote URL of a local Git repository

Inspect fetch and push URLs, distinguish configured URLs from rewritten URLs, and understand why origin is not a permanent record of the original clone.