7 ms·
"I still can't think of a better language for scripting." Python I find equally if not more simple. Would you agree?
by ace33 5y ago
"I still can't think of a better language for scripting."
Python I find equally if not more simple. Would you agree?
- sodapopcan 5y agoEqually maybe. Simpler? I'm not sure, I don't know Python very well. A couple of things I found surprising about Python was having to do the whole `re.compile` thing instead of just `//` in Ruby. Also, no one will ever convince me that a list comprehension is simpler than `map` and related functions. Also, it's hard to beat the convenience of libs that let you do `1.day.ago`. Ruby gets complicated when people start throwing around metaprogramming where they shouldn't. I do like Python's file == module. Python seems like it would be a good functional programming language but it goes and only allows for single line lambdas. Again, I don't know Python very well.
- revscat 5y ago> Ruby gets complicated when people start throwing around metaprogramming where they shouldn't. This is true. Thankfully it appears that the broader Ruby community has recognized this as well, and has moved away from metaprogramming to a large extent. It's still there, but you don't see it utilized nearly as frequently as you once did.
- sodapopcan 5y agoI'm fine with it for libraries. In fact, its use in libraries is a lot of makes ruby great! It goes too far when people start sprinkling it in business logic making it impossible to find where anything is defined. I'd say you'd either have to go full-lisp and create an entire DSL for your domain (and document it) or keep it completely out of business logic (which, as you say, the community as a whole has pretty much figured this out).
- AtlasBarfed 5y agoI am not a Python or a Ruby dev. The Ruby devs I know are overall great devs The Python people are second-rate. Ruby produced tons of good software as a framework base besides Rails. Python? Eh.
- linspace 5y agoI'm a Python dev. The python devs I know are average on average. I have never met a Ruby dev. But I'm sure I'm first rate!
- weatherlight 5y agoIt's not about simplicity, It's about expressivity.
- kouteiheika 5y ago> Python I find equally if not more simple. Would you agree? Simple, yes. But when I want to write a script as fast as possible with the least amount of effort I don't want simple. I want convenient and powerful. Many things which in Python take multiple lines in Ruby are simple one liners. There's a certain dichotomy between Ruby and Python that I also see in many other pairs of languages. One language is simple, easy to learn and easy to read (Python), but is not as powerful or convenient to write. The other language is more complex, harder to learn and harder to read (Ruby), but is more powerful and convenient to write. It seems like most people prefer the first category, which I think is why languages like Python or Go are so popular. There's nothing wrong with that as it's a tradeoff, but I personally prefer the second category, which is the reason why I do all of my scripting in Ruby and not in Python like everybody else. Simply put I don't really mind the extra complexity since it is essentially mostly a one time cost, so I always pick whichever tool will make me more efficient in the long run. And out of the two (Python and Ruby) that's Ruby. (With a few exceptions like, e.g. machine learning, where you don't really have a choice.)
- Mikeb85 5y agoNope. Can't stand that Python uses built-in functions for basic things like list, map, fold, etc... instead of methods on base classes. Here's a super basic example. Add one to an array [1,2,3] and print results. Python: print(list(map(lambda x: x + 1, [1,2,3]))) Ruby: print [1,2,3].map {|x| x + 1} So much more readable, easy to write, etc... Ruby keeps it consistent by making pretty much everything an object and you just call methods. Even Haskell has dot notation to chain functions since it's just so much easier to read and write...
- j_mo 5y agoThis is what really put me off Python as somebody who learned Ruby as their first proper (professional 9-5 usage) programming language. There are other things too, like how print used to be written like a keyword not a function for some reason, and enforced indentation instead of braces or "end" keywords, all just really bugged me. It felt like somebody made YAML Turing complete...
- iterati 5y agoprint([x + 1 for x in [1,2,3]])
- KerrAvon 5y agoThis really goes to the heart of the problem with modern Python. It's lost the simplicity of the language which was the whole point of it in the first place. OO and functional paradigms were bolted on to varying degrees of success, but an outsider can no longer look at average Python code and understand it at a glance.
- gmfawcett 5y agoList comprehensions were added to Python in version 2.0, which was released 21 years ago. That was about six years after Python 1.0 was released. Are you seriously pining for the simplicity of Python 1.x? (Most of the "outsiders" you're talking about were in elementary school at the time, I don't think they were reading a lot of Python!)
- wfleming 5y agoReally depends on what you mean by "simple". "Simple" is one of those descriptors that gets tossed around a lot in programming by rarely with a clear definition. Python is a "simpler" language with its preference for "one obvious way", and it does tend to support fewer paradigms than Ruby. Ruby is a more complex language, supporting many approaches. But if you are familiar with the various approaches, that can be "simpler" if it allows you to choose the most fitting approach for whatever problem you have at hand. To put it another way, "simple" can mean "the language is small/has an obvious way it wants you to do things", or "simple" can mean "the language is flexible enough to be used to model your problem in the most appropriate way". Python is the first kind of simple, Ruby is the second. IMHO Ruby is much more expressive than Python, and the stdlib is better designed and less crufty. Ruby really has one of the best stdlibs around, I think, and a lot of languages could learn a lot from it - particularly the design of `Enumerable`. So I prefer Ruby when I have the choice. Part of that is probably just familiarity, but I've been a full time dev on both Ruby & Python projects for long stretches of time so I think I'm in a decent position to compare them. My personal preferences/taste is another aspect, of course, and there's no objective accounting for that. The case where I often will prefer Python is if I'm scripting something that needs some degree of portability. If you pick a random Linux box it's much more likely to have some version of Python installed than Ruby, so if I'm writing something that should be easy to copy to a box and use without additional setup, I'm more likely to pick Python.
- rahoulb 5y agoPersonally I think writing Python is like writing maths, writing Ruby is like writing English. Depends which one you prefer.
- vidarh 5y agoWhether or not it is true, that would certainly explain why I prefer Ruby so strongly over Python.
- gilbetron 5y agoHaving done both professionally, I'll take Python any day of the week. The "Expressivity" lauded by Ruby fans translates into a lack of readability. But the things that drives me crazy is the optional/alternative syntax of ruby.
- nitrogen 5y agoRuby is a lot like spoken language in that regard. When the many ways in which to do things are chosen well, Ruby reads like pure poetry. For that I will always enjoy Ruby. Moreover, the choice of which idiom to use conveys the intent and mindset of the author. But like any complex language, it's also possible to write very unpoetically, and like any complex language, readability is a function of familiarity with the language's syntax and idioms.
- marquis_andras 5y agoRuby has the ability to automatically download required gems in single-file scripts via bundler. I don't know of any equally convenient alternative for my python scripts. e.g. https://gist.github.com/destiny-index/2a2e7e586bb9cd6e5c3000e8ae86a8aa https://gist.github.com/destiny-index/2a2e7e586bb9cd6e5c3000...
- dwaite 5y agoThey are surprisingly different. Ruby has a focus on developer joy and productivity. In some cases this comes to the detriment of language simplicity, and existing features can complicate language evolution. Surprisingly with this complexity Ruby has had a bit more success with optimized implementations than Python, such as Truffle Ruby. Ruby is a bit more multi-paradigm than Python IMHO, and has been jokingly called a "language for connecting adults". One can monkey-patch override division to return fractions, with the person maintaining the project deciding if this is a good idea or not. This can potentially make projects with a large number of dependencies harder to debug, which interestingly seems to have created some push-back on importing lots of arbitrary dependencies. With both Python and Ruby, you wind up having divisions between dependencies because of the poor mismatch between different paradigms - for instance, libraries built to work with Python Twisted or Ruby EventMachine for I/O, or libraries built to work generically or to integrate into say Django on Python's side or Rails on Ruby's side. Interestingly the communities seem to have different key focus areas - Ruby has historically been very focused on testing (cucumber and selenium for instance) while Python has had a lot of focus on documentation (pydoc and sphinx). Oddly, neither really has had a noticeable literate programming push.
- cipheredStones 5y agoIs "language for connecting adults" an autocorrect of "language for consenting adults"?
- dwaite 5y agoHah yes it was
- busterarm 5y agoPython forces you to wrestle with its'/Guido's idiosyncracies. It wears them on its sleeve almost like a badge of honor. You may enjoy them, but I don't. Lack of Tail Call Optimization is a huge red mark for me, personally. Ruby, on the other hand, is literally meant to delight you with its choices/options/expressiveness and I find that it absolutely delivers on that promise.
- deleted 5y ago[deleted]
- vidarh 5y agoPython is entirely unreadable to me. Not in the sense that I can't but in the sense that I have to put effort into it in a way I don't have to with Ruby. Part of it is undoubtedly that I'm very picky about syntax and formatting and Python has made a lot of choices that are pretty much the opposite of what I want, but I just can't get used to reading Python code.
- zem 5y agoi write python for a living (and have done so for the last five years) but i still find ruby fits my brain better, and it's what i reach for when i want to write a quick script for some personal use.
- Too 5y agoEven if you would rate the languages themselves equal to one another. The ecosystem of Python is several orders of magnitude larger. Anything you want to do has a python module or an example. I think the real question is, is it really worth giving up all that for two minor improvements in syntax.
- montblanc 5y agoAs a Rails dev it's extremely rare for me to need some functionality that Ruby doesn't cover. If you're doing standard web development most likely you're gonna be fine with Ruby. I've been doing this with Ruby for around 8 years so I bumped into quite a few use cases...there are gems for all the standard things. But yes outside web - data science, web crawlers etc...Python has the clear advantage.