Before you start¶
Impatient? Want to start programming right now? Here are a few things to understand first, before you start.
Python can be mission-critical¶
Unixoid operating systems (Linux, to some extend macOS) rely on Python for some of their mission-critical tasks. Hence, installing a different Python version may easily break the whole system. Typically, package managers for Linux distributions rely on (old) Python versions.
Warning
Never, ever, install a current Python version globally on your system without knowing what you’re doing. Otherwise you may break your system, making a complete new install necessary.
Always use virtual environments¶
Python provides excellent means of isolating different projects from each other. This means that you can use different versions of Python and of each of the packages for different projects, without messing with the system-wide installed packages. This prevents serious headaches and messing with your operating system. Remember: Python can be mission-critical (vide supra).
Warning
Always use (separate) virtual environments for each of your Python projects. Python provides you with easy-to-use tools for this.
Read and understand PEP 8 and PEP 257¶
Code ought to be readable by humans. Code the computer cannot read or understand is useless, as it doesn’t work. Code that works but humans cannot understand is similarly broken, but much more common.
The Python community has a very clear idea how code should be formatted, codified in their Python Enhancement Proposal (PEP) 8. Read and understand it, and then stick to it. Similarly, read and understand PEP 257 dealing with the formatting of documentation within the source code (“Docstrings”), and afterwards apply it to your code.
Organise yourself¶
You simply want to start hacking, trying something out. Fair enough. However, even the smallest script often grows into a project of its own. Hence, organise yourself from the very beginning. Create a directory for your Python projects, put each project in a different subdirectory, create a virtual environment (vide supra) for each of the projects.
And as soon as your script grows to more than 100 lines: use an editor/a proper IDE, use (local) version control (git!), document – at least with a README file.
Know basics of your operating system¶
There are a few things you need to know that I will not tell you in this course. You need to know how to install programs on your computer (without messing up with your system, vide supra) on a per-user base or system-wide, and how to open a terminal.