Skip to content

Python guidelines

Oliver Lantwin edited this page Oct 14, 2024 · 1 revision

General guidelines to improve the quality and readability of our python code. For python, see the C++ guidelines.

General

  • PREFER iterating over containers to indexing containers manually
  • PREFER argparse over getopt
  • ALWAYS use ruff-format (for new code) and ruff-check
  • ALWAYS place import statements at the top of the file
  • NEVER run non-trivial code at the top-level scope of your module, so that it can be imported without side-effects. INSTEAD, hide this code behind an if __name__ == "__main__": condition

FairRoot/FairShip specific

Clone this wiki locally