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

bonono at gmail.com bonono at gmail.com
Thu Dec 15 07:32:39 EST 2005


jmdescha... at gmail.com wrote:
> 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*
> ;-)
What I don't quite understand is, if it is "obvious", whether there is
a Zen, people would still code it that way(unless of course they want
to hide it from others or make it difficult to understand on purpose),
there won't be any argument of "which one is the obvious way".
And if there is an argument(or disagreement), which one is the obvious
?

I think it is more like there is a preferred way, by the language
creator and those share his view.




More information about the Python-list mailing list