Python

Use when working with a language that lets you work quickly and integrate systems more effectively

tomevault-io Updated

File contents

Python Skill

Best Practices

  1. PEP 8: Follow standard style guide (Snake case for vars, 4 spaces indent).
  2. Type Hints: Use typing module (List, Optional, etc.) for robust code.
  3. Virtual Envs: Always use venv or poetry. Never install global pip packages.
  4. Exceptions: Catch specific exceptions (ValueError), never bare except:.

Common Pitfalls

  • Mutable Defaults: def func(list=[]): causes bugs. Use None instead.
  • GIL: Threads don't speed up CPU tasks. Use multiprocessing.

References


Converted and distributed by TomeVault — claim your Tome and manage your conversions.

tomevault-io/skills-registry/tree/main/sami--widgets--python commit 407d7c107e

Frequently asked questions

npx skillmds@latest add tomevault-io/python