note
eyepopslikeamosquito
<P>
<blockquote>
<I>
can be a big weakness when it comes to Perl being used in a bigger team as you need to explicitly
agree on how to do things when with Python or Java there is simply one obvious way
</I>
</blockquote>
Agreed, with caveats about there being "simply one obvious way" in Python, as detailed below.
It seems you and I are one of the "many" mentioned in <a href="http://www.dev411.com/blog/2009/01/24/can-epo-or-tpf-tame-timtowtdi/">John Wang</a>'s
claim that
<I>"TIMTOWTDI is often cited as a strength but, taken to an extreme, it is also seen as a weakness by many"</I>.
</P>
<P>
I much prefer the <a href="https://ww2.enlightenedperl.org/">Enlightened Perl Organisation</a> alternative TIMTOWTDIBSCINABTE, pronounced "Tim Toady Bicarbonate":
<blockquote>
There's more than one way to do it, but sometimes consistency is not a bad thing either
</blockquote>
</P>
<P>
Python's <a href="https://wiki.python.org/moin/TOOWTDI">TOOWTDI</a> ("There should be one -- and preferably only one -- obvious way to do it")
notwithstanding, I discovered that, in practice, Python sometimes provides more ways to do it than Perl!
</P>
<P>
As analysed in [id://814900], when considering how to create a <C>"Dear John"</C> string
in each of the four languages (Perl, Python, Ruby, PHP) I could only see one obvious way to do it in Perl namely:
<CODE>
"Dear $name"
</CODE>
while in Python I found three:
<CODE>
"Dear %s" % expr # Python % printf-like operator
"Dear {0}".format(expr) # Python format string method
"Dear "+`expr` # Python backticks (TIMTOWTDI)
</CODE>
</P>
<P>
And from the classic [id://909285|99 bottles of beer golf],
when changing between "Take one down and pass it around" and "Go to the store and buy some more" -
shortening the two strings above to "Take" and "Go to" for clarity -
let's consider the many and varied ways of doing this in Python (TIMTOWTDI):
<CODE>
"Take"if n else"Go to"
(n>0)*"Take"or"Go to"
["Go to","Take"][n>0]
("Go to","Take")[n>0]
n and"Take"or"Go to"
"GToa kteo"[n>0::2] # "Slice and Dice" wins this golf!
</CODE>
Admittedly, the winning Python slice and dice golf solution can hardly be described as obvious. :)
As you can see, playing golf in Python is fun because there <I>is</I>
more than one way to do it!
</P>
<P>
Curiously, code golf is more popular in Python than Perl nowadays. See [id://763105] for evidence.
</P>
1212716
1212875