From: Michal Suchanek Date: 2010-11-30T07:21:04+09:00 Subject: Re: Ruby's "More than one way to do things." On 29 November 2010 19:40, deepak wrote: > hi, > saw this on twitter today: > http://guide.python-distribute.org/introduction.html#current-state-of-packaging > where he was making a point that "it sure is complicated for a > language having one way of doing things" > > It is good to have multiple options, find the best solution to a > problem by applying common sense and good taste, take feedback/ > benchmark and iterate. > > Not really sure how the python zen works. Maybe having no choice in > indentation, multi-line lambdas etc are obvious. i dunno. If it comes > with experience and then it is no better than having options and > discovering the best option through experience, irc, mail-group, > benchmarks, awesome community, pretty ok docs and your own common > sense and good taste. The point is that there is no one right way, the right way depends on context. The python zen does not work for me at least. Take a small example: Python is supposedly an object oriented language but you don't have "string".len you only have len("string") supposedly for the case when an object does not implement len by itself but the length can still be determined (possibly to be 1 or or 0 on scalars). Sure, in Python you can't just monkey-patch a len to something that could have it determined but does not implement it so to have only one true way you need a procedural len() which goes against OO. In Ruby you have "string".length and you can always write procedural len() if it makes your code look nicer and you can also add length to any object you want (well, except for integers but you could use some voodoo if you really insisted). Thanks Michal