python-complexity
Skill16 starsChanged 2 months agoMITView on GitHub
Look up and apply Python builtin and standard-library time and space complexity when analyzing code, reviewing performance, or comparing operations. Includes implementation and version qualifications. Use for complexity analysis, not general Python syntax questions.
In this repository6 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- docs/llms.txtllms.txt
- documenting-complexity-modulesSkill
- testing-complexity-claimsSkill
- updating-python-supportSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
Use the bundled reference to analyze the user's Python code or operation.
- Distinctive: line 16
Start with the reference index.
- Distinctive: line 21
Use the detailed operation page rather than relying on a summary index.
- Distinctive: line 39
Treat the bundled pages as evidence with a defined scope, not a proof for every input or release.
- Distinctive: line 43
Do not claim to have checked sources or run benchmarks unless you did so.
- Distinctive: line 44
Use asymptotic bounds to explain scaling.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Python Complexity
Use the bundled reference to analyze the user's Python code or operation. It is a snapshot of the Python Complexity project, with its version, supported Python range, source revision, and file hashes recorded in manifest.json. References are readable offline; no runtime or package installation is required.
Find the relevant reference
Start with the reference index. It groups pages by builtin, standard-library module, implementation, and Python version. Follow only the links relevant to the question. Search within those pages for the actual method or operation; read its table notes and the surrounding qualifications.
Use the detailed operation page rather than relying on a summary index. For a version-dependent question, also read the relevant version page and the module's version notes. Do not load the entire reference into context.
Apply the evidence
- Identify the concrete types and input-size variables. Use the user's Python version and implementation when supplied; otherwise state any assumption that affects the answer. Do not transfer CPython-specific bounds to other runtimes.
- Preserve distinctions between average, amortized, and worst-case bounds. State what each space bound counts: auxiliary memory, returned storage, or retained input. If the page leaves that ambiguous, say so instead of guessing.
- Account for the complete code path: setup, repeated operations, iterator consumption, materialization, and the lifetime of intermediate results. Do not apply an iterator-creation bound to its full consumption.
- Identify user-supplied hashing, equality, comparison, key functions, or other callback costs when they affect the analysis. State relevant assumptions rather than silently treating arbitrary user code as constant cost.
- Treat the bundled pages as evidence with a defined scope, not a proof for every input or release. If a page is missing, contradictory, or does not cover the requested version, explain the gap. When source access is available and needed, verify against official documentation or the matching released implementation. Do not claim to have checked sources or run benchmarks unless you did so.
- Use asymptotic bounds to explain scaling. Do not promise a measured speedup from Big-O alone. Recommend a different operation only when its semantics fit the user's needs; preserve the user's requested scope.
Present the result
Give time and space complexity, define the size variables, and state the assumptions that affect the conclusion. For code, connect the individual operations to the total bound. Cite the relevant bundled page; its canonical website URL is also listed in its topic catalog. Distinguish the page's claim from your derived analysis and any unresolved uncertainty.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

