Python was my first programming language and I have been programming for about 5 years now. I LOVE Python, but there is one thing I haven't got myself to believe yet. In the Zen of Python one of the entries is: "There should be one, and preferably only one, obvious way to do things." And while I was able to write that from memory, I still have a hard time with it.

So, can any of you Pythoneers/Pythonistas explain this to me? Logic and/or examples would be great ( although good luck proving it to me WITHOUT logic :p ).

Thanks in advance,

- WolfShield

I think this motto should not be understood too strictly. Here are a few hints

1) If there is only one (preferably obvious) way to do things, this reduces considerably the design part of writing software. Everybody agrees on the unique possible solution.

2) Obviously (and hopefully) this is not so in real life. There ARE several ways to do things, so the motto must be understood as an unreachable ideal.

3) Perhaps, this applies best to writers of APIs or UIs. Offering only one way to do things makes a much simpler interface. So perhaps when Tim Peters wrote the zen of python, he mainly targetted python developers and this was a guidance rule for python, to offer only the best way to do each thing.

4) As everybody knows, this was also a response to perl's TIMTOWTDI, which looks appealing to the beginning perl programmer, but rapidly leads to indecipherable code. At the time python and the zen of python were written, perl was a leader in scripting languages, and pythonistas had to give arguments as to why their language was better.

Edited 4 Years Ago by Gribouillis: n/a

This question has already been answered. Start a new discussion instead.