Skip to content

Material for the course "Python best practices", Scientific Software Center, Heidelberg University

License

Notifications You must be signed in to change notification settings

ssciwr/Python-best-practices-course

Repository files navigation

Code style: black

Python-best-practices-course

Material for the course "Python best practices", Scientific Software Center, Heidelberg University

Inga Ulusoy, June 2024

Python has rapidly advanced to the most popular programming language in science and research. From data analysis to simulation and preparation of publications, all can be done in Python with appropriate libraries and implementing own modules. We will discuss most important Python Enhancement Proposals (PEP) and how these can help you write cleaner code. You will learn how to use a code linter and code formatter. Common pitfalls in Python will be explained with examples. We will demonstrate typical “bad programming” and how to code the examples in a more pythonic way.

Prerequisites

Basic Python knowledge is required. Participants need a laptop/PC with a working Python environment installed, ideally in an IDE, and a GitHub account as we are using GitHub classrooms.

Learning objectives

After the course participants will be able to

  • Understand the basic PEP recommendations
  • Use a linter and code formatter to ensure following of the guidelines
  • Write better=more readable code
  • Avoid bugs through best practices for example in passing keyword arguments

Time and place

The course takes place in the conference room of the Mathematikon Bauteil A (room 5/104).

Course date: June 4th 2024, 9:00AM - 1:00PM

Course content

  1. PEP recommendations
  2. Linting
  3. Code formatting
  4. Write better code: Pitfalls
  5. Write better code: Examples

Additional Topics

For general coding best practices, you should always put your source code under version control, implement tests and a documentation, and also add a license to your code. It is not possible to discuss all of this in a short course - here we only discuss Python-specific content. The SSC offers tailored courses that you can participate in. There is also a block course that touches on all these aspects; the block course takes place every year in February/March.

About

Material for the course "Python best practices", Scientific Software Center, Heidelberg University

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published