pairs [( 'one')( 'two')( 'three')( 'four')pairs sort(key=lambda pairpair[ ]pairs [( 'four')( 'one')( 'three')( 'two')documentation strings here are some conventions about the content and formatting of documentation strings the first line should always be shortconcise summary of the object' purpose for brevityit should not explicitly state the object' name or typesince these are available by other means (except if the name happens to be verb describing function' operationthis line should begin with capital letter and end with period if there are more lines in the documentation stringthe second line should be blankvisually separating the summary from the rest of the description the following lines should be one or more paragraphs describing the object' calling conventionsits side effectsetc the python parser does not strip indentation from multi-line string literals in pythonso tools that process documentation have to strip indentation if desired this is done using the following convention the first non-blank line after the first line of the string determines the amount of indentation for the entire documentation string (we can' use the first line since it is generally adjacent to the string' opening quotes so its indentation is not apparent in the string literal whitespace "equivalentto this indentation is then stripped from the start of all lines of the string lines that are indented less should not occurbut if they occur all their leading whitespace should be stripped equivalence of whitespace should be tested after expansion of tabs (to spacesnormallyhere is an example of multi-line docstringdef my_function()"""do nothingbut document it noreallyit doesn' do anything ""pass print(my_function __doc__do nothingbut document it noreallyit doesn' do anything function annotations function annotations are completely optional metadata information about the types used by user-defined functions (see pep and pep for more informationannotations are stored in the __annotations__ attribute of the function as dictionary and have no effect on any other part of the function parameter annotations are defined by colon after the parameter namefollowed by an expression evaluating to the value of the annotation return annotations are defined by literal ->followed by an expressionbetween the parameter list and the colon denoting the end of the def statement the following example has positional argumenta keyword argumentand the return value annotateddef (hamstreggsstr 'eggs'-strprint("annotations:" __annotations__(continues on next page more control flow tools