@@ -31,34 +31,36 @@ For Python code, we generally follow [PEP 8](https://www.python.org/dev/peps/pep
3131We get around Python flexible type system in several ways:
3232* we try to avoid "magic" (e.g., generating or changing classes on the fly);
3333* we are fairly verbose with naming, trying to help the reader with following the types;
34- * we follow our type annotation system for method and function docstrings
35- (planning to switch to [ PEP 484] ( https://www.python.org/dev/peps/pep-0484/ ) );
36- see later for the format.
34+ * We use [ PEP 484] ( https://www.python.org/dev/peps/pep-0484/ ) type annotations.
3735
38- We support Python 3 only, requiring at least version 3.9.
36+ We support Python 3 only. See the Installation documentation for the current
37+ minimum supported Python version.
3938
40- # Docstring type annotation format
39+ # Docstring format
4140
42- We use a custom format for type annotation in method and function docstrings. Here's an example taken from the code:
41+ Our docstring format is simple, if a little nonstandard.
42+ Here's an example taken from the code:
4343
4444```
4545class Cls(object):
4646 [...]
47- def example(self, a, b, c=None):
47+ def example(
48+ self, a: int, b: list[dict[str, int]], c: Submission | None = None
49+ ) -> tuple[int, str]:
4850 """Perform an example action, described here in one line.
4951
5052 This is a longer description of what the method does and can
5153 occupy more than one line, each shorter than 80 characters.
5254
53- a (int) : a is a required integer.
54- b ([{str: int}]): b is a list of dictionaries mapping strings to
55- integers, and note how the docstring wraps with indent.
56- c (Submission|None) : c is either a Submission (not required to
57- fully specify, but it could be helpful for symbols that are
58- not imported) or None.
55+ a: a is a required integer.
56+ b: b is a list of dictionaries mapping strings to integers, and
57+ note how the docstring wraps with indent.
58+ c: c is either a Submission (not required to fully specify, but
59+ it could be helpful for symbols that are not imported) or
60+ None.
5961
60- return ((int, str)) : this method returns a tuple containing an
61- integer and a string.
62+ return: this method returns a tuple containing an integer and a
63+ string.
6264
6365 raise (ValueError): if a is negative.
6466 raise (LookupError): if we could not find something.
0 commit comments