[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6FEF1F1CCKN7BBHSKRP70TF":3,"skill-same:01M6FEF1F1CCKN7BBHSKRP70TF":45},{"skillNo":4,"name":5,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":20,"frontMatter":21,"refName":22,"commitSha":23,"skillDirectory":24,"forksCount":25,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M6FEF1F1CCKN7BBHSKRP70TF","python",null,"ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fpython\u002FSKILL.md",[],[5],"2026-11-10 10:12:30",false,"# Python 3.11 Best Practices\n\nComprehensive performance optimization guide for Python 3.11+ applications. Contains 42 rules across 8 categories, prioritized by impact to guide automated refactoring and code generation.\n\n## When to Apply\n\nReference these guidelines when:\n- Writing new Python async I\u002FO code\n- Choosing data structures for collections\n- Optimizing memory usage in data-intensive applications\n- Implementing concurrent or parallel processing\n- Reviewing Python code for performance issues\n\n## Rule Categories by Priority\n\n| Priority | Category | Impact | Prefix |\n|----------|----------|--------|--------|\n| 1 | I\u002FO & Async Patterns | CRITICAL | `io-` |\n| 2 | Data Structure Selection | CRITICAL | `ds-` |\n| 3 | Memory Optimization | HIGH | `mem-` |\n| 4 | Concurrency & Parallelism | HIGH | `conc-` |\n| 5 | Loop & Iteration | MEDIUM | `loop-` |\n| 6 | String Operations | MEDIUM | `str-` |\n| 7 | Function & Call Overhead | LOW-MEDIUM | `func-` |\n| 8 | Python Idioms & Micro | LOW | `py-` |\n\n## Table of Contents\n\n1. [I\u002FO & Async Patterns](references\u002F_sections.md#1-io--async-patterns) — **CRITICAL**\n   - 1.1 [Defer await Until Value Needed](references\u002Fio-defer-await.md) — CRITICAL (2-5× faster for dependent operations)\n   - 1.2 [Use aiofiles for Async File Operations](references\u002Fio-aiofiles.md) — CRITICAL (prevents event loop blocking)\n   - 1.3 [Use asyncio.gather() for Concurrent I\u002FO](references\u002Fio-async-gather.md) — CRITICAL (2-10× throughput improvement)\n   - 1.4 [Use Connection Pooling for Database Access](references\u002Fio-connection-pooling.md) — CRITICAL (100-200ms saved per connection)\n   - 1.5 [Use Semaphores to Limit Concurrent Operations](references\u002Fio-semaphore.md) — CRITICAL (prevents resource exhaustion)\n   - 1.6 [Use uvloop for Faster Event Loop](references\u002Fio-uvloop.md) — CRITICAL (2-4× faster async I\u002FO)\n\n2. [Data Structure Selection](references\u002F_sections.md#2-data-structure-selection) — **CRITICAL**\n   - 2.1 [Use bisect for O(log n) Sorted List Operations](references\u002Fds-bisect-sorted.md) — CRITICAL (O(n) to O(log n) search)\n   - 2.2 [Use defaultdict to Avoid Key Existence Checks](references\u002Fds-defaultdict.md) — CRITICAL (eliminates redundant lookups)\n   - 2.3 [Use deque for O(1) Queue Operations](references\u002Fds-deque-for-queue.md) — CRITICAL (O(n) to O(1) for popleft)\n   - 2.4 [Use Dict for O(1) Key-Value Lookup](references\u002Fds-dict-for-lookup.md) — CRITICAL (O(n) to O(1) lookup)\n   - 2.5 [Use frozenset for Hashable Set Keys](references\u002Fds-frozenset-for-hashable.md) — CRITICAL (enables set-of-sets patterns)\n   - 2.6 [Use Set for O(1) Membership Testing](references\u002Fds-set-for-membership.md) — CRITICAL (O(n) to O(1) lookup)\n\n3. [Memory Optimization](references\u002F_sections.md#3-memory-optimization) — **HIGH**\n   - 3.1 [Intern Repeated Strings to Save Memory](references\u002Fmem-intern-strings.md) — HIGH (reduces duplicate string storage)\n   - 3.2 [Use __slots__ for Memory-Efficient Classes](references\u002Fmem-slots.md) — HIGH (20-50% memory reduction per instance)\n   - 3.3 [Use array.array for Homogeneous Numeric Data](references\u002Fmem-array-for-numeric.md) — HIGH (4-8× memory reduction for numbers)\n   - 3.4 [Use Generators for Large Sequences](references\u002Fmem-generators.md) — HIGH (100-1000× memory reduction)\n   - 3.5 [Use weakref for Caches to Prevent Memory Leaks](references\u002Fmem-weak-references.md) — HIGH (prevents unbounded cache growth)\n\n4. [Concurrency & Parallelism](references\u002F_sections.md#4-concurrency--parallelism) — **HIGH**\n   - 4.1 [Use asyncio for I\u002FO-Bound Concurrency](references\u002Fconc-asyncio-for-io.md) — HIGH (300% throughput improvement for I\u002FO)\n   - 4.2 [Use multiprocessing for CPU-Bound Parallelism](references\u002Fconc-multiprocessing-cpu.md) — HIGH (4-8× speedup on multi-core systems)\n   - 4.3 [Use Queue for Thread-Safe Communication](references\u002Fconc-queue-communication.md) — HIGH (prevents race conditions)\n   - 4.4 [Use TaskGroup for Structured Concurrency](references\u002Fconc-taskgroup.md) — HIGH (prevents resource leaks on failure)\n   - 4.5 [Use ThreadPoolExecutor for Blocking Calls in Async](references\u002Fconc-threadpool-blocking.md) — HIGH (prevents event loop blocking)\n\n5. [Loop & Iteration](references\u002F_sections.md#5-loop--iteration) — **MEDIUM**\n   - 5.1 [Hoist Loop-Invariant Computations](references\u002Floop-hoist-invariants.md) — MEDIUM (avoids N× redundant work)\n   - 5.2 [Use any() and all() for Boolean Aggregation](references\u002Floop-any-all.md) — MEDIUM (O(n) to O(1) best case)\n   - 5.3 [Use dict.items() for Key-Value Iteration](references\u002Floop-dict-items.md) — MEDIUM (single lookup vs double lookup)\n   - 5.4 [Use enumerate() for Index-Value Iteration](references\u002Floop-enumerate.md) — MEDIUM (cleaner code, avoids index errors)\n   - 5.5 [Use itertools for Efficient Iteration Patterns](references\u002Floop-itertools.md) — MEDIUM (2-3× faster iteration patterns)\n   - 5.6 [Use List Comprehensions Over Explicit Loops](references\u002Floop-comprehension.md) — MEDIUM (2-3× faster iteration)\n\n6. [String Operations](references\u002F_sections.md#6-string-operations) — **MEDIUM**\n   - 6.1 [Use f-strings for Simple String Formatting](references\u002Fstr-fstring.md) — MEDIUM (20-30% faster than .format())\n   - 6.2 [Use join() for Multiple String Concatenation](references\u002Fstr-join-concatenation.md) — MEDIUM (4× faster for 5+ strings)\n   - 6.3 [Use str.startswith() with Tuple for Multiple Prefixes](references\u002Fstr-startswith-tuple.md) — MEDIUM (single call vs multiple comparisons)\n   - 6.4 [Use str.translate() for Character-Level Replacements](references\u002Fstr-translate.md) — MEDIUM (10× faster than chained replace())\n\n7. [Function & Call Overhead](references\u002F_sections.md#7-function--call-overhead) — **LOW-MEDIUM**\n   - 7.1 [Reduce Function Calls in Tight Loops](references\u002Ffunc-reduce-calls.md) — LOW-MEDIUM (100ms savings per 1M iterations)\n   - 7.2 [Use functools.partial for Pre-Filled Arguments](references\u002Ffunc-partial.md) — LOW-MEDIUM (50% faster debugging via introspection)\n   - 7.3 [Use Keyword-Only Arguments for API Clarity](references\u002Ffunc-keyword-only.md) — LOW-MEDIUM (prevents positional argument errors)\n   - 7.4 [Use lru_cache for Expensive Function Memoization](references\u002Ffunc-lru-cache.md) — LOW-MEDIUM (avoids repeated computation)\n\n8. [Python Idioms & Micro](references\u002F_sections.md#8-python-idioms--micro) — **LOW**\n   - 8.1 [Leverage Zero-Cost Exception Handling](references\u002Fpy-zero-cost-exceptions.md) — LOW (zero overhead in happy path (Python 3.11+))\n   - 8.2 [Prefer Local Variables Over Global Lookups](references\u002Fpy-local-variables.md) — LOW (faster name resolution)\n   - 8.3 [Use dataclass for Data-Holding Classes](references\u002Fpy-dataclass.md) — LOW (reduces boilerplate by 80%)\n   - 8.4 [Use Lazy Imports for Faster Startup](references\u002Fpy-lazy-import.md) — LOW (10-15% faster startup)\n   - 8.5 [Use match Statement for Structural Pattern Matching](references\u002Fpy-match-statement.md) — LOW (reduces branch complexity)\n   - 8.6 [Use Walrus Operator for Assignment in Expressions](references\u002Fpy-walrus-operator.md) — LOW (eliminates redundant computations)\n\n## References\n\n1. [Python 3.11 Release Notes](https:\u002F\u002Fdocs.python.org\u002F3\u002Fwhatsnew\u002F3.11.html)\n2. [PEP 8 Style Guide](https:\u002F\u002Fpeps.python.org\u002Fpep-0008\u002F)\n3. [Python Wiki - Performance Tips](https:\u002F\u002Fwiki.python.org\u002Fmoin\u002FPythonSpeed\u002FPerformanceTips)\n4. [Real Python - Async IO](https:\u002F\u002Frealpython.com\u002Fasync-io-python\u002F)\n5. [Real Python - LEGB Rule](https:\u002F\u002Frealpython.com\u002Fpython-scope-legb-rule\u002F)\n6. [Real Python - String Concatenation](https:\u002F\u002Frealpython.com\u002Fpython-string-concatenation\u002F)\n7. [Python Tutorial - Data Structures](https:\u002F\u002Fdocs.python.org\u002F3\u002Ftutorial\u002Fdatastructures.html)\n8. [CPython Exception Handling](https:\u002F\u002Fgithub.com\u002Fpython\u002Fcpython\u002Fblob\u002Fmain\u002FInternalDocs\u002Fexception_handling.md)\n9. [DataCamp - Python Generators](https:\u002F\u002Fwww.datacamp.com\u002Ftutorial\u002Fpython-generators)\n10. [JetBrains - Performance Hacks](https:\u002F\u002Fblog.jetbrains.com\u002Fpycharm\u002F2025\u002F11\u002F10-smart-performance-hacks-for-faster-python-code\u002F)\n",{},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fpproenca\u002Fdot-skills\u002Fpython",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":7,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill python",{"tool":37,"command":38},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill python",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill python","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fpproenca\u002Fdot-skills\u002Fpython\u002FSKILL.md",true,[],[46,55,64,73,79,85],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[52,53,54],"model","model hierarchy","model hierarchy skill",{"skillNo":56,"name":57,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[61,62,63],"MCP","zoom","zoom mcp",{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[70,71,72,62],"sdk","zoom apps sdk","apps",{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[75],{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":18},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[81],{"skillNo":86,"name":87,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":7,"ownerLogin":8,"ownerAvatarUrl":9,"ownerAccountNo":10,"ownerDisplayName":11,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[87]]