Skip to content

language

#24: Multiple Return Values?

In a talk at NDC I saw an interesting feature of Python: A method returned not one but two values, a list of parsed entries and a list of entries with errors. This powerful feature is called unpacking of a tuple and can make your code a lot simpler.

#22: Lambda Functions

Sometimes we need a callable object that we can use as an argument to a function. While we could create a function for that purpose, there is another way that needs less typing.

#19: Working with Packages in Python

The ecosystem of Python with all the helpful third-party libraries makes it such a productive language. It is therefore time to look where we can find them and how we can install those packages. For this post I use the term packages to describe the distribution units of Python code, not the way how you can organise your code using folders and the __init__.py file. That will be the topic of a later post.

#18: Working With the File System

If you do anything with automation, you may need to work with the file system and move files and folders around. This post shows you how to use the different built-in modules and functions of Python to get the job done.

#17: What is PEP?

I used the abbreviation PEP in a few posts without every explaining what this is. It is now time for a closer look at the development process of the Python programming language.

#16: Working With Files

When you want to use Python for little maintenance tasks on your computer, you will need to work with files. Python offers you a range of built-in functions to do that and this post covers the most common ones. However, this post does not cover working with binary files. You most likely will need a specific library to work with them and the documentation of that library can explain the details much better than I can.

#15: Documenting Your Code

With comments in the code we can record our thoughts and considerations that led to our implementation. While this is a great help for developers that need to change the code, it is often not helpful to those who just want to use it - they are drown in detail and miss the big picture. What they need is documentation and luckily for us, Python has a great built-in feature called docstring to solve exactly that problem.

#12: Exceptions

When you start learning a new programming language, you will first fight a lot with the syntax. Before you even can run your program you already get an error that you need to fix. After a while those syntax errors get less and less, and you can focus on creating a working application.

You quickly realise that valid Python syntax is not enough, your code must be able to handle wrong user input, missing resources or network errors. You now entered the endless challenges of creating a robust application and exceptions (and their handling) are an important part of it.