String Concatenation Explained

I’ve written a tutorial at Codementor.io and I want to share it with you.

This article is about how string concatenation works under the hood and how you can improve performance using an old best practice — and why you should use it.

You can find the article here.

Happy reading!

Object-Oriented Programming (OOP)

Now we arrived at object-oriented programming. This has (had) its hype where every language was designed around objects and Python developer Guido van Rossum thought “Why not?” and added classes to support object-oriented development. Some python evangelists think this was a bad decision, some think it was a good approach…

This article is an excerpt of my book Python 3 in Anger. For a more detailed version take a look at the book.

Continue reading

Guess the number — The return

We have seen this example previously. There I included a lot of loops to handle user input and the main logic… Now it is time to refactor the application to use functions. This should make the code readable and we could re-use parts later.

One of those re-usable parts is the number reading. We have two points where we want the user to enter a number and have written slightly the same code. This is a very good place to start refactoring and extract this into one function.

This article is an excerpt of my book Python 3 in Anger. For a more detailed version take a look at the book.

Continue reading

Functions

Now we have learned the basics of Python programming: variables, collections and loops. If you have followed the examples and the tutorial you might feel that sometimes we use too much code and it can be leveraged a bit. But maybe you do not know how to do it.

This article is an excerpt of my book Python 3 in Anger. For a more detailed version take a look at the book.

Continue reading