Python

Write reliable Python avoiding mutable defaults, import traps, and common runtime surprises.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Python" with this command: npx skills add ivangdavila/py

Quick Reference

TopicFile
Dynamic typing, type hints, duck typingtypes.md
List/dict/set gotchas, comprehensionscollections.md
Args/kwargs, closures, decorators, generatorsfunctions.md
Inheritance, descriptors, metaclassesclasses.md
GIL, threading, asyncio, multiprocessingconcurrency.md
Circular imports, packages, init.pyimports.md
Pytest, mocking, fixturestesting.md

Critical Rules

  • def f(items=[]) shares list across all calls — use items=None then items = items or []
  • is checks identity, == checks equality — "a" * 100 is "a" * 100 may be False
  • Modifying list while iterating skips elements — iterate over copy: for x in list(items):
  • GIL prevents true parallel Python threads — use multiprocessing for CPU-bound
  • Bare except: catches SystemExit and KeyboardInterrupt — use except Exception:
  • UnboundLocalError when assigning to outer scope variable — use nonlocal or global
  • open() without context manager leaks handles — always use with open():
  • Circular imports fail silently or partially — import inside function to break cycle
  • 0.1 + 0.2 != 0.3 — floating point, use decimal.Decimal for money
  • Generator exhausted after one iteration — can't reuse, recreate or use itertools.tee
  • Class attributes with mutables shared across instances — define in __init__ instead
  • __init__ is not constructor — __new__ creates instance, __init__ initializes
  • Default encoding is platform-dependent — always specify encoding='utf-8'

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

Dlazy One Click Generation

Short-video generation pipeline. Configure subject, script, TTS voiceover, BGM, and subtitle styling.

Registry SourceRecently Updated
Coding

Dlazy Video Generate

Video generation skill. Automatically selects the best dlazy CLI video model based on the prompt.

Registry SourceRecently Updated
Coding

Dlazy Audio Generate

Audio generation skill. Automatically selects the best dlazy CLI audio/TTS model based on the prompt. 音频生成技能。根据提示词自动选择最佳的 dlazy CLI 音频/TTS 模型。

Registry SourceRecently Updated
Coding

Dlazy Vidu Audio Clone

Clone voice and generate new text reading audio with one click using Vidu Audio Clone.

Registry SourceRecently Updated
Python | V50.AI