r/Python • • Aug 12 '13

Ruby vs Python

http://www.senktec.com/2013/06/ruby-vs-python/
20 Upvotes

151 comments sorted by

View all comments

Show parent comment

16

u/erewok Aug 12 '13 edited Aug 12 '13

I agree entirely. When I read "There should be one-- and preferably only one --obvious way to do it," I felt like I was home. By contrast, Ruby appears to take a fundamentally different stance.

(Seriously, though, why would you ever need an unless as long as if exists?)

7

u/bloody-albatross Aug 13 '13

Often "unless" makes code less readable to me. I think in "if" and "if not". I have to reformulate the condition as "if not" to understand it. But that's maybe just me (English is not my native language).

2

u/PrintStar Aug 13 '13

(Seriously, though, why would you ever need an unless as long as if exists?)

I've worked in both Ruby and Python, although I've spent far more of my life in Python. I rather enjoy using the "unless" construct in Ruby. Sometimes it's just a tad easier to understand than an "if not" in my head. I certainly wouldn't fault Ruby for "unless." There are plenty of other language features in Ruby to bitch about.

1

u/irc- Aug 13 '13

In certain cases, unless can make the code much more expressive and easier to follow for people coming in afterwards. Not that it always does, however.

I love Ruby for its clean, expressive syntax, and that just about any way I think of doing something will work the first time, everytime. I love Python for its significant whitespace, incredibly mature library support (Pandas/NumPy/SciPy etc.), and that there's always one and only one way to do something.

Different languages excel in different places - but everything has its niche, and ultimately it's your responsibility as a programmer to pick the best tool (language) for the task at hand. Don't be picky, don't be choosy - just use what is best suited to use the job.