As I am very fond of old style Role Playing Games, I am working on a toy project about Advanced Dungeons and Dragons, 1st edition. Now, this game is full of strange rules. For example, when the characters encounter a group of monsters, both parties have to roll a d6 (standard six faced die); if one of the parties rolls 1 or 2, that party is surprised. Also, in this case, the value of the die (1 or 2) indicates the number of "segments" (6 seconds period) for which that party is surprised. In my first Python implementation, this lead me to write a method in the Party class, which was something like this: def surprise_segments(self): roll = random.randint(1, 6) return roll if roll <= 2 else 0 Pretty simple, right? This simple piece of code didn't satisfy me very much. The roll variable wasn't very useful here: it was just a temp variable to keep the roll value so that it could be used in the following expression. So, I decided to extract that pa