- Home
- Skills
- Copyleftdev
- Sk1llz
- Beazley
beazley_skill
- Python
3
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill copyleftdev/sk1llz --skill beazley- SKILL.md8.3 KB
Overview
This skill teaches you to write Python in the style of David Beazley: generator-driven, introspective, and focused on Python internals. It emphasizes generators, coroutines, context managers, descriptors, metaclasses, and pragmatic concurrency. Use it when you need compact, memory-efficient, and deeply understood Python solutions.
How this skill works
The skill inspects your problem and proposes idiomatic Beazley-style patterns: generator pipelines, coroutine state machines, yield-from delegation, contextlib-based resource management, and purposeful metaprogramming. It suggests concrete code snippets and design choices that prioritize laziness, protocol understanding, and predictable resource lifecycles. It also highlights concurrency trade-offs (GIL, async vs threads) and memory profiles.
When to use it
- Processing very large or streaming datasets without materializing them
- Designing pipeline or coroutine-based state machines
- Creating small, explicit metaprogramming utilities (descriptors, metaclasses) with clear justification
- Implementing scoped resource management with contextlib and ExitStack
- Building async code that respects cooperative multitasking and concurrency limits
Best practices
- Prefer generator pipelines over creating large intermediate lists
- Understand the underlying protocol before using an API (iterator, context manager, descriptor)
- Use yield from to delegate and compose generators cleanly
- Use contextlib for concise, testable resource handling and combine managers with ExitStack
- Profile before optimizing and avoid threads for CPU-bound work in CPython unless using multiprocessing or native extensions
Example use cases
- Stream-process huge log files with composable generator filters and parsers
- Implement coroutine-based protocol handlers or state machines for event-driven code
- Create typed attributes using descriptors and generate slots with a metaclass for memory efficiency
- Rate-limited async fetchers using semaphores and asyncio.gather for bounded concurrency
- Temporarily patch objects during tests with contextmanager wrappers
FAQ
Only when you need to alter class creation semantics or auto-generate class attributes; prefer decorators or descriptors for simpler tasks.
Are generators always better than lists?
Use generators when you can process items lazily to save memory; materialize lists when random access or multiple passes are required.