Using the official Python docs under contest conditions
- Module
- C.2
- Lesson
- 1 of 1
- Reading time
- 5 min
In this lesson
- Find a function's exact signature quickly on docs.python.org, for modules such as heapq, bisect, collections, itertools, and math.
- Read a page's "Added in version" and "Changed in version" notes, and judge from them whether a feature is safe to use on Python 3.8.
- State that the official Python documentation is the only outside reference the contest rules allow.
The module on contest rules already covers what a CCC submission may and may not draw on. The official Python documentation is the one outside reference the rules allow you to open during the contest. No search engine, no forum post, no AI tool, and no notes copied in from somewhere else are permitted. Everything you might need to look up has to come from that one site. Finding a page fast, and reading it correctly once you are there, is a skill worth practicing well before the contest, rather than for the first time during it.
Finding a signature fast
Every module page on docs.python.org lists its functions in the same shape. A heading names the function. The heading is followed by its signature in parentheses. A paragraph explaining what the function does comes after that. heapq.heappush(heap, item) is one such heading. Its parentheses show it takes a heap and the item to add, in that order. Searching the page itself for the function's name lands you on the right heading far faster than reading the whole page top to bottom. Five module pages are worth knowing by name, since between them they cover most of the standard-library tools a CCC solution reaches for: heapq, bisect, collections, itertools, and math.
Each of those five pages has its own shape of contents worth recognizing on sight. The heapq page lists functions for treating a plain list as a heap, such as heappush and heappop. The bisect page lists functions for finding a position in a sorted list, such as bisect_left. The collections page mostly describes a handful of specialized container types, such as deque and Counter, rather than standalone functions. The itertools page lists functions that build or combine iterators, such as product and combinations. The math page lists ordinary numeric functions, such as gcd and isqrt, each with a short, simple signature.
Reading a signature once you have found it
A signature lists every parameter a function takes, in the order it expects them. Take bisect.insort(a, x, lo=0, hi=len(a)) as an example. It takes a list and a value to insert as its first two parameters. Two more parameters, lo and hi, come after those two, already carrying default values shown after the = sign. A parameter with a default can be left out of a call entirely. A parameter without one cannot be left out. itertools.product(*iterables, repeat=1) uses a * before its first parameter name. That mark means the function accepts any number of arguments in that position, not only one. Reading a signature this closely, before calling the function, catches a mismatched argument count long before it becomes an error at submission time.
Added in version, and changed in version
A docs page also states when a function, or one of its parameters, was introduced or changed. A note reading "Added in version 3.9" under a function means that function does not exist at all on an older Python. A note reading "Changed in version 3.9" attached to one parameter means something narrower. The function itself existed earlier, but that particular parameter, or that particular behaviour, is newer than the rest of it. The module on the Python 3.8 language boundary already covers math.gcd as an example of exactly this pattern. A newer docs page shows a form of math.gcd accepting any number of arguments, marked "Changed in version 3.9". The CCC grader's PyPy runs 3.8, which only accepts the older, two-argument form of the same function.
The version notes on the default docs page describe the newest Python, not the 3.8 the grader runs. Reading docs.python.org/3.8/, in place of the plain docs.python.org/3/, shows every signature exactly as it stood at 3.8, with none of the later additions mixed in. Checking a signature against the 3.8 page directly confirms a feature is safe to use. That is more reliable than reading the version notes on the default page alone and hoping they are complete.
Practicing the lookup itself
Reading this lesson once does not build the speed a contest rewards. A short, timed drill does: pick a function you half-remember, such as heapq.heappushpop, and time how long it takes to land on its exact signature from a blank page. Repeating this with a handful of functions from each of the five pages above, every so often, keeps the skill sharp without ever needing to memorize a signature outright. Knowing which page a function lives on, and roughly where on that page, matters more than memorizing the signature itself. The page is always there to check during the contest.
The docs are the only reference allowed
Outside of the contest, looking up how a function works means a search engine, a forum thread, or an AI assistant. None of those are available during a CCC submission window. Practicing the habit of reaching for docs.python.org first, before ever wanting a shortcut, means the contest does not feel like the first time you have worked this way.
Recap
Docs.python.org lists a module's functions with a heading, a signature, and an explanation. Searching the page for a name is the fast way to the right heading. Knowing which of the five pages, heapq, bisect, collections, itertools, or math, a function lives on narrows the search before it even starts. A signature's parameter order and default values tell you exactly how to call a function correctly. "Added in version" and "Changed in version" notes mark when a feature was introduced or changed. Checking the 3.8-specific page directly is the more reliable way to confirm a signature matches the grader's Python. During the contest, the official docs are the only outside reference the rules allow at all.