Zen of Python – Are the rules adaptable to soccer?

So no matter if in soccer or in Python there are some principles you should follow to become successful. Of course, they don’t always fit 100% to every game and to every style of coding, but they can serve as a good reference point. But we should definetly take a look at them. We start with the Zen of Python.

The Zen of Python is a collection of 19 “guiding principles” for writing computer programs that influence the design of the Pythonprogramming language – Wikipedia.

Here we go:

  1. Beautiful is better than ugly.
  2. Explicit is better than implicit.
  3. Simple is better than complex.
  4. Complex is better than complicated.
  5. Flat is better than nested.
  6. Sparse is better than dense.
  7. Readability counts.
  8. Special cases aren’t special enough to break the rules.
  9. Although practicality beats purity.
  10. Errors should never pass silently.
  11. Unless explicitly silenced.
  12. In the face of ambiguity, refuse the temptation to guess.
  13. There should be one—and preferably only one—obvious way to do it.
  14. Although that way may not be obvious at first unless you’re Dutch.
  15. Now is better than never.
  16. Although never is often better than right now.
  17. If the implementation is hard to explain, it’s a bad idea.
  18. If the implementation is easy to explain, it may be a good idea.
  19. Namespaces are one honking great idea—let’s do more of those!

I admit that they appear a bit too clever at the beginning, but they are important, so keep in mind to refer to them again and again during your work.

Do those concepts fit for soccer as well? Lets try:

  1. No, playing beautiful but losing every game is the last thing you should do in soccer.
  2. Yes, being explicit in Python means being concrete and specific instead of abstract and general. It also means not to hide the behavior of a function. In soccer the coach should explicitly tell you what to do and not give misunderstandable instructions too.
  3. Yes, playing simple when you can is a good idea.
  4. Yes, although complex and complicated sound alike, they do not mean the same in this context. It is okay to build very complex applications, as long as the need for it is reasonable. So in soccer you should play complex only if you need to as well.
  5. Yes, flat usually refers to how data is organized, but can also refer to things like if statements. Nested “ifs” are where you check one if, then inside that, check another if, etc. instead just check both variables. Same in soccer: flat play, high win.
  6. No, code that is spread out over multiple lines is often easier to read than dense one-liners. I can’t see a connection to soccer here.
  7. No, nobody cares about readability in soccer.
  8. Yes, don’t break the rules in soccer even if the game goes crazy.
  9. Yes, walking the line between number 8 and 9 becomes easier with experience. And in time, you’ll not only learn the rules, but also learn when to break them. I mean in soccer sometimes it is fair to operate on the edge you know. Imagine Diego Maradonna would have tell everybody that his goal with the hand against England 1986 during the world cup shouldn’t count. He was experienced enough to just keep silent, because he knew the positive implications.
  10. Yes, it’s better for a program to fail fast and crash than to silence the error and continue running the program. The bugs that inevitably happen later on will be harder to debug since they are far removed from the original cause. In soccer that means better see and face the weaknesses of your team during the preparation phase then in the season.
  11. Yes, you can always choose to explicitly ignore the errors your programs cause, just be sure you are making the conscious choice to do so. Same in soccer. If you igonore something make sure you won’t regret it in the future. E.g. don’t ignore to train both feet, because there will be situations, where you have to shoot with the weaker one.
  12. Yes, if your code isn’t working, there is a reason and only careful, critical thinking will solve it. Same in soccer. If you loose 10 games in a row there seems to be a real challenge. Don’t just go in the 11th game and hope this time you are going to win without analyzing and solving the problems of the other games.
  13. No, in soccer you have many ways to score a goal and to win a game but they aren’t always obvious and unique.
  14. No, this line is a joke. Guido van Rossum, the creator and BDFL (Benevolent Dictator for Life) of Python, is Dutch. However, not even this aphorism prevented Python from incorporating three different ways of formatting strings. As a german I can’t comment anything realted to Dutch soccer here :-P.
  15. Yes, like Nike would say: Just do it.
  16. Yes, it’s almost certainly better to wait for your program to finish than to have it finish too early with incorrect results. So don’t go to a championsleague game unless you are not well enough prepaired as the result will not be good then.
  17. No, if a coach wants to implement a complex tactic it may need some time until the players internalise it but thats okay.
  18. No, thats not always right, sometimes you need a more complex system e.g. to play against Barcelona and to restrict their game and Leo Messi especially.
  19. No, as great as they are, namespaces should be made only to prevent naming conflicts, and not to add needless categorization. I don’t see a connection to soccer here.

Note: Some explanations of the principles come from https://inventwithpython.com/blog/2018/08/17/the-zen-of-python-explained/.

#Mastery03

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s