Concrete examples of Python's "only one way to do it" maxim
Posted
by
Charles Roper
on Programmers
See other posts from Programmers
or by Charles Roper
Published on 2011-07-27T16:43:03Z
Indexed on
2014/05/30
3:51 UTC
Read the original article
Hit count: 477
I am learning Python and am intrigued by the following point in PEP 20 The Zen of Python:
There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch.
Could anyone offer any concrete examples of this maxim? I am particularly interested in the contrast to other languages such as Ruby. Part of the Ruby design philosophy (originating with Perl, I think?) is that multiple ways of doing it is A Good Thing. Can anyone offer some examples showing the pros and cons of each approach. Note, I'm not after an answer to which is better (which is probably too subjective to ever be answered), but rather an unbiased comparison of the two styles.
© Programmers or respective owner