Thanks
I much prefer Python. I thought for a long time that this was because I learned most of the fundamentals of computer science and professional development in the language, but I'm at the point now where I'm sure that's not the case. The Zen of Python really shows the differences between the two of them - "explicit is better than implicit", versus Ruby's "convention over configuration". I don't mind writing some boilerplate in Python, because the boilerplate is itself fairly terse and fully informs you of your system's architecture in the process.
I hate that functions aren't first-class objects in Ruby. Hate it. The subtle distinctions and behavioral differences between blocks, Procs, and lambdas are infuriating.
There are many things I would change about Ruby, but there's nothing wrong with it. It's just not a good fit for my way of thinking.
All that said, the question was "Has Python killed Ruby?" No, it hasn't. Ruby is still popular, and I think it very much fits the manner of thinking of many developers. For them, thinking in Ruby is natural and wrangling Python into submission would feel like writing Ruby does to me.
When you talk about "functions are not first class objects", do you mean you cannot assign it to a var? Well thats because they are not functions, they are methods. I think thats great. A method belongs to a class. Thats how Smalltalk also implemented it, as far as I know. In fact Ruby and smalltalk (the mother of all OO languages) shares a lot in common.
If you like functional programming style, thats fine, but yeah then maybe you should use haskell, erlang, elixir, ...
For most boring everyday cases Python's "type system" (it's too much to call it so, but anyway) is quite ok, catches lots of bugs that would seep through in Javascript or PHP, plus functions as first class objects to match everyone intuition and it's quite a pleasant experience.
Where they are different in terms of syntax or capability or philosophy, I nearly always prefer ruby.
I find bundler/Gemfile/rvm to be less headachy for project dependency management than pip/requirements.txt/venv.
For me, ruby code is easier and more pleasant to read.
When I need to write a quick bit of temporary code or do some simple data parsing/file management, I nearly always use ruby if it doesn't matter which language I use.
But if I had to choose one of them to learn, I would focus on python -- even with everything I said above and the really long and drawn out (and still unsuccessful) transition to python 3.
Python has much stronger non-web app libraries and perfectly adequate web app libraries and is definitely much more widely supported in academia. Ultimately there are more things you can do with python and more python job opportunities.
I'm asking because I'm primarily a js dev with a bit of Ruby and Ruby on Rails experience, and I'm wondering if Python/Ruby are worth investing in at this point and if perhaps instead it makes more sense to stick with js (Yarn in particular for package management) and explore more fundamental (C/C#/C++/Swift/Objective-C) or exotic (Haskell, Clojure) communities/languages/environments at this point.
The kind of prototypes that I can hack together with Python + whatver frontend in a day can take 4x as much to do with Nodejs for me, simply because there are so many micro-decisions to make at every point (libA or micro-libC + micro-libB or mega-lib-D kind of stuff). And the way it leaves you with you "brains fried" after wrangling with some async bug... not worth it imho. Better to have the boring technical micro-decision made by someone else for you so you can concentrate on the cool stuff.
If you're working on anything where the product OR idea OR algorithm OR ux-process is much much much more important that "ecosystem" or scalability bulshit, nodejs will always feel at least 2x slower to develop in than either Python (if you're into AI/ML-ish things) or Ruby or Go or Elixir...
For web apps my alternative receipe would be to keep the web app nodejs and more the smarter-than-crud stuff to microservices written in anything but Nodejs.
I like npm. For package management, I think npm is on par with bundler (ruby) and thus a bit better than pip. I like the ease of use of package.json scripts and find myself using them more and more. They feel lighter and easier to set up than the ruby equivalent (rake tasks, usually), although when you start doing fairly complex stuff (e.g., custom asset management), they can get a bit unwieldy.
As for the ecosystems, I find javascript is more in flux. It is more work to keep dependencies up to date or to decide what library to use when you need one, and I've had apps break on minor and patch updates to dependencies fairly often.
There is also a focus on small libraries that just do one thing. Nothing wrong with that, but the number of dependencies some projects have is a bit crazy.
If you work with Ruby or Python for web stuff, you inevitably end up using JS for the frontend, so it is certainly a reasonable choice to use Express as the server and go full Javascript.
And my company does that a fair amount, but when we need an app to do something more complicated than serve web pages and talk to the database, we end up moving over to flask/python to take advantage of python's better libraries (esp. for math/science/data stuff).
So, I still see some value in picking up python. Nothing wrong with any of the other languages though, and you can learn a lot from any language. Depends on your interests and needs really.
If you're doing DevOps, you should probably learn both.
Everything else, which is more backend, APIs, data, data science, AWS, Google Cloud, Big Data databases, etc - Python over Ruby. You may want to consider Java here tho depending on how much performance is required due to many of those aforementioned Big Data platforms having the JVM underneath the hood.
So all things being equal, Python, and then for all things not being equal, Python.
But as of yet there's nothing in the JS ecosystem that compares to Ruby on Rails or Django for back-end stuff, so it's worth learning one or both those two as well.
For finding work: learn both, or pick the one that is more popular in your desired field, geographic location, etc.
For improving yourself as a programmer: go for Python first but learn both (good introduction to how programming languages are both different and alike). If you can't be bothered by or interested or learning both, reconsider your field of work, because both are fun.
For anything else: if you're capable of weighing the pros and cons of either in regards to support (hiring coders), project size, level of complexity needed etc.: Python strikes me as the slightly safer / more robust choice, especially in academia, but I'm not confident about recommending either one primarily.
Not correct. Its primary use case doesn't limit its scope, and there's tons of utility programming done in Ruby. (for example, Chef and Puppet are written in Ruby)
Also, a lot of research on dynamic languages is being done with Ruby, e.g. TruffleRuby, JRuby, RubyOMR, and probably a few more I'm forgetting. Each of those projects is an impressive body of work in and of itself that points to Ruby being very alive and well. Oh, almost forgot about MRuby. I don't think there are similar efforts for Python. In some sense Python is much more stagnant these days in terms of innovation at the language level.
That is open to disagreement. I will say the same, but of python.
HOWEVER, among the languages that put "aesthetically pleasant" as part of the charm, I think is safe to say that python/ruby are from the top 5.
Any of both will be a good choice using that criteria (and even considering the troubles with BOTH), so in my mind is hard to go "wrong" with any of them. Both have other features that could weight in the choice, but at level of language are more brothers in spirit than enemies.
---
I don't see ruby "killing" python, (I'm more a fan of python, ok?); just for the look of it the niches of both are more defined now.
SADLY, js is what is killing all the other languages in the web space. I wish a better language was the cause, but not, must be the far worse, more terrible, but the NON-choice.
As for JS; what with TypeScript and ES6 (despite the worry of clutter) I can't help but wonder if it's the best non-choice we could have hoped for.
Python is also very much not stagnant. Look at all of the major changes and feature additions in Python 3.3, 3.4, 3.5, and now 3.6.
Could you elaborate on that? I've used more Ruby than Python, and I'm aware of the fact that it's often more 'pleasant', but I'm very curious what you can tell me about Python's sharp corners, because even without using it I've been very attracted to the 'explicit over implicit' mantra after being bitten quite a few times by Ruby's ease (quote unquote, perhaps?).
(As in, so far Ruby feels like a good choice in general, but especially to someone new to programming, but I've grown to love explicit over implicit, not to mention functional over non-functional, and so but even without using Python I'm positive I might prefer it. I'd really love to hear what the gotcha's are in that particular ecosystem)
Python may be more stagnant and the implementation level (at least, in terms of experiments outside of the main interpreter like the ones you describe for Ruby), but the language itself seems to be advancing much faster than Ruby right now.
I wrote a small Rails project a while back and along with it small non-Rails utility that made used a couple of generic modules (mail, config). Both the Rails project and the utility bit-rotted faster than anything anything that I ever written. Ruby, the language, is pleasant, and you can write beautiful, terse, expressive code. Functional constructs are nice, etc. Soured me on Ruby, I am afraid. I liked Perl too, and Ruby is not that different.
Python... I don't care for the significant whites space. lambda is crippled because it has to fit into a single line, tertiary operator is weird, and compressions reads backwards to me. Haskell has the same problem. It is nice how you can start with a class, then wrap attribute access later. Writing a simple new style class is verbose. The version 2 to 3 was rough, not sure if it's done by now. There is a lot of libraries, some parts of the standard library are nice.
JavaScript to me is mess with classes being bolted on, different ways to build an object, different ways to handle errors, different ways to handle callbacks. The write it once and run it either in browser and server ignores that version differences (i.e. what is the crappiest browser you have to support), and in general that environment is different. node.js with the async is an interesting experiment. To me it becomes difficult to read and reason about. To me, it was surprisingly difficult, to write a small sync util in node.js. There is a metric ton of libraries. I quite like JavaScript, but to me its becoming complex (as in C++) instead of burning off the bad parts (as in C). The language will be around "forever" due to the web, so that is what I use if possible.
That said, while I personally fell JS is decent with the ES6/ES2015 additions, I do share your worry that it erred on the side of complexity by adding a shit-ton of stuff that maybe should have been more carefully considered. It appears modern JS is and will become the kitchen-sink language, which I suppose is fitting.
But once again, that's still pretty cool. I love how I can introduce someone to programming using JS nowadays and actually be able to teach a whole bunch of different syntactical concepts. I also love how what you can do with JS directly impact the one thing most of us are constantly staring at (web pages). All in all I think things turned out better than I expected as far as the web ecosystem goes. Programming wise. Don't get me started on my worries about the increasingly walled-garden world we appear to live in...
Ruby on Rails was a eye openner (my exposure to web was ASP classic (auch!!!) and ASP.NET (auch!!)) and the tutorial of
Was something good. I choose later python just because I think is a better overall language, but I have always read what the other side have to say. I will not hate to work on ruby, in contrast to, let say, js or java.
Not hate a language is probably a more nice thing that just like it ;)
----
You must balance much more that just the superficial aspect of the syntax, despite that I agree syntax MATTER A LOT. With time the superficial syntax will become a more deeper aspect of the experience (when you truly understand the language and see the semantic behind the words), but the ecosystem, the thing you plan to build, how well you absorb the knowledge, etc are also important.
Even when 2 languages look "nice" is possible that down the road one be "better" in your mind and other "harder" or the opposite. For example I get lost reading C-like languages and get easy Pascal-like language for the same thing and the same level of difficult.
For example, I read
And I loved it, but I can't make haskell work for real (to me). The language look nice at first, but it not "connect" to me. Instead I get F#.
Learn Ruby if you want to get started in web development, most of Ruby development projects is based on Ruby on Rails, and as a beginner is VERY easy to get started, you will get things done very quickly once you set it up.
Learn Python if you want to do... well, between the two of them python is way more popular in everything but web development. There's web frameworks with Python but I wouldn't recommend them for someone who is starting now (personally, I gave up on Django for Rails).
Nowadays it is better to start with javascript. It's not "beautiful" like those two languages, but is very forgivable and node.js is all the hype right now.
If you're doing DevOps, you should probably learn both.
Everything else, which is more backend, APIs, data, data science, AWS, Google Cloud, Big Data databases, etc - Python over Ruby. You may want to consider Java here tho depending on how much performance is required due to many of those aforementioned Big Data platforms having the JVM underneath the hood.
If you know exactly what you want and it's web, then Ruby, otherwise, all things being equal, Python, and then for all things not being equal, Python.
Beyond that Ruby isn't used much. But a language that's extensively used for one very common purpose is very very far from dead.
- Ruby is used for Chef.
- Python is used for Ansible.
Chef on the other hand is Ruby. Pretty much fully exposed as such.
Python quality libraries seems better. for Example: I have not found a good HTTP client like Python's Requests or Guzzle from Php
Have you tried HTTParty? https://github.com/jnunemaker/httparty
A programmer chooses a languages which is convenient for the task at hand. Ruby/Rails are amazing to lift off projects in hours.
</not the answer you/anyone wanted to hear>