.. _coding_guidelines:
Coding Guidelines
=================
Style guide
-----------
Follow the recommendations from `PEP 8 – Style Guide for Python Code `_.
Docstring
---------
Docstrings should use the reStructuredText (reST) format. For details see, e.g., `this stackoverflow question `_, the `Sphinx + ReadTheDocs documentation `_ or the example below.
Example:
.. code-block:: python
def my_function(param1):
"""
This is a reStructuredText style.
:param param1: first param
:type param1: type of first param
:return: description of what is returned
:rtype: type of return value
:raises keyError: raises an exception
"""
Further reading:
- `PEP 257 – Docstring Conventions `_
- `PEP 287 - reStructuredText Docstring Format `_
Important notes
---------------
- Memory allocation: If expanding or modifying crossover or mutation functionalities, care must be taken to **only modify deep copies** of offspring route objects. Otherwise, modifications might lead to overwriting of parent objects and thus undefined behaviour of the optimisation process.