Why and how "there is only one way to do something"?

jmdeschamps at gmail.com jmdeschamps at gmail.com
Thu Dec 15 07:24:39 EST 2005


Tolga wrote:
> As far as I know, Perl is known as "there are many ways to do
> something" and Python is known as "there is only one way". Could you
> please explain this? How is this possible and is it *really* a good
> concept?

if you 'import this', you get a bit of Python Zen... from which I have
taken this line:
*...
There should be one-- and preferably only one --obvious way to do it.
...*
If this is what you are referring to then here is an explanation.

So there is not 'only one way', but rather there should be a way to do
something that is obvious, re easy to find, evident, 'given'...
The quality(ies) looked for here that makes this *really* good is
1- that you don't spend an inordinate amount of time looking for it -
you just go along and use it so your mind can be focussed of what you
need to achieve instead of how you can achieve it.
2- If it's 'obvious', then chances are others will see it and use it
also, so that their code is more understandable by others. For anyone
who has taken care of code of others this can be *really really good*
;-)

Jean-Marc




More information about the Python-list mailing list