7 ms·
...semi off-topic, but man, how I wish Ruby had won the hearts of data-science and machine-learning practitioners instead of Python or R! It looks like such a w
by nnq 7y ago
...semi off-topic, but man, how I wish Ruby had won the hearts of data-science and machine-learning practitioners instead of Python or R! It looks like such a wonderful and extensible and programmer friendly language compared to all the others in the "multi-purpose dynamic 'scripting' languages class". Every time I read Ruby code it almost puts a smile on my face, it seems such a joy to write and think in, so sad it didn't break out of its niche much :(
- skrebbel 7y agoSame! I never used Rails much but did learn Ruby and used it a lot for the kind of stuff people tend to use Python for nowadays. Data crunching, prototyping, sciency stuff.. It's excellent for that. I mean, Ruby is so much more elegant and consistent than Python, I'll never understand how Python became the more widely appreciated language of the two, especially with the effective head start that Ruby had through Rails' popularity.
- stanislavb 7y agoI guess the answer is - Google. As it used Python and the word was out. Also, Python had been released a few years earlier and so was adopted by universities.
- jhanschoo 7y agoFrom my perspective, it was the was the ipython notebook (now jupyter) that was the killer app leading to Python being adopted for data science.
- kjeetgill 7y agoI'd say python was pretty big in academic circles even before that if memory serves.
- cdavid 7y agoGoogle had little influence on scientific python. I agree python did not have technically much advantage over ruby, but: 1. Old history of using python for scripting linux, starting from mid-late 90ies, especially around clusters and HPC, i.e. where you find applied scientists in academia. 2. A full C API. Not especially good, but powerful enough. I don't think ruby is much different, but wrapping C with python, again for HPC (or GUI libs). Lua C API is definitely better. 3. Communities matter 4. Different people starting to talk to each other more and more, and right timings. First mid 90ies (numeric/numarray, use in astronomy, etc.), then early-mid 2000ies (NumPy/SciPy consolidation, matplotlib, ipython), then late 2000 with scikit learn, and pandas. Also, while I know little about ruby, I fail to see how much better it is than python. Both are essentially the same w/ some minor syntactic differences, and different communities. I have never seen an example where ruby was much better than python or vice versa for non trivial code. I mean is RoR that much better than Django ? I doubt that stuff matters very much.
- pansa 7y ago> I’ll never understand how Python became the more widely appreciated language IMO syntax is a major factor. Python looks like pseudocode, while Ruby looks like Perl.
- SeekingMeaning 7y agoGenuinely curious, what makes Python look more like pseudocode? The use of colons? Regardless, I’ve always thought that Ruby is more like pseudocode because with Ruby, I’m able to worry less about syntax and more about what I’m trying to do. Maybe it’s just me?
- pansa 7y ago> Genuinely curious, what makes Python look more like pseudocode? The use of colons? I used to think it was significant indentation, but if you look at the pseudocode on e.g. Wikipedia, there is no significant preference for either whitespace or begin/end. Therefore, it’s probably things like `if value in my_map` vs `if my_map.contains(value)` and `[x * 2 for x in my_list]` vs `my_list.map(x -> x * 2)`.
- SeekingMeaning 7y agoAh, yeah. In that regard, I agree, Ruby could use some improvement.
- nnq 7y ago- `if value in my_map` is a one off special case - ugly, nasty, hard to figure out how to extend it (what if I invented my_map to have special logic for `in` ...I need to search the docs for a magic method called for that operator ...if I even know for what keywords to search, ugh) - `if my_map.contains(value)` is nice and consistent, easy to search for the code of the .contains method and figure out what it does - `[x * 2 for x in my_list]` another ugly special case syntax, instead of general purpose higher order functions, even in Python while a `.map` method could've been easily added to dictionaries too, we had to wait years (decades?) for dictionary comprehensions to land in the language, and it's another damn special syntax one has to remember. ugh! - a sane solution not involving higher order functions usage would've been to make everything in the language an expression and have `for ...` expressions return lists or dictionaries or sets, still better than the fugly "list comprehension", I really can't comprehend why people like them - `my_list.map(x -> x * 2)` nice, clean, and general. If I work with a weirder list like thingy and want to see the logic of mapping, I can easily jump to the definition of it's `.map` method Most pseudocode is ugly and ambiguous and actually hard to read without special context from the text around it because you're never sure what something actually means, can't easily "jump to its implementation code and read it". Same like natural language, hard to non-ambiguously understand and ugly as hell in technical context where math and diagrams work 1000x times better. I can't understand why people who are trained in math, physics and/or other sciences would ever choose something just because it "looks more like pseudocode"... To me pseudocode rhymes with... pseudoscience! It's never what you want when you can choose something better.
- vmchale 7y ago>I'll never understand how Python became the more widely appreciated language of the two NumPy, maybe? Lots of resources make it easy to get small impressive projects off the ground quickly.
- jessewmc 7y agoI can think of two reasons: A sort of Dutch Disease caused by Rails is probably the biggest one. When one killer feature drives the adoption of a language, everyone who is interested and good at the language is involved with that ecosystem, and it becomes self sustaining. The other one (already alluded to elsewhere here) is the culture of monkey patching and meta-code. I worked professionally in Rails for years, and I really enjoy Ruby, but every time I had a problem or question that required digging into the Rails source I was tearing my hear out. Almost everything is a cascade of hundreds of single line methods built on an avalanche of DSL abstraction and depending on implicit monkey patching and other crazy stuff that's a nightmare to understand. It's not a culture of readable code in sizeable projects, which is what you need if you want to be widely adopted by people who don't primarily write code for a living (scientific work, other general work). Ironic considering how expressive and beautiful Ruby can be.
- nirvdrum 7y agoI don't have any data to back this up, but I suspect solid Windows support was a big driver of that. I used to do a fair bit of Python before Ruby and there was a nice MSI installer for the runtime and plenty of libraries had precompiled Windows installers available. This was important because we were working with some software that necessitated running Windows. I love Ruby, but when I started developing in it, I was surprised at how much the Windows experience lagged behind just about everything else I had tried up until that point (Java, Python, Perl, x86 Assembly, at least). Even today, it's not really easy to run for anything requiring native extensions. You have to set up a separate compiler* just to build those extensions because most gems don't push binaries out. That may be better for security, but I don't think that's the driving factor. You're better off just running JRuby, assuming WSL isn't an option. * Granted, RubyInstaller makes this a lot easier nowadays.
- bjoli 7y agoAs someone who sometimes steps out of the comfort of writing scheme, I agree with you. I spent a lot more time writing python than I did ruby, but with ruby I can just jump right in and things work like I expect them to. With python there is always small semantic things that moves the whole experience into slightly uncomfortable territory. But whatever floats people's boats. If I had to do numeric computation I would chose python as well, but personally I would become a grumpy fart that would complain way too much
- lmm 7y agoI shudder to think what datascience code would look like if a language with a culture of monkeypatching/metaclassing had won. Clear code is nice, but not when the price is sweeping all of the details too deeply under the carpet.
- nnq 7y ago> sweeping all of the details too deeply under the carpet Ever worked with numpy, scipy, pandas etc. in Python? It's ALL about what you call "sweeping the details under the carpet", or what is generally called abstraction. When abstraction is well "swept under the rug", eg. "you can use it without understanding it much" it's called non-leaky abstraction, and is the best kind of abstraction. Sure, there's languages like Go that are all about NOT sweeping things under the rug. But that's a different niche.
- DarkWiiPlayer 7y agoI don't really know much about python, but how is the C API? Because as nice as Ruby may be as a language, I wouldn't want to touch the C API with a laser pointer. Maybe python just has a nicer API, leading to more people writing fast C libs for it instead of Ruby; and ultimately many people will just use the language with the fastest libraries for their domain (specially the kind of people that have some influence on their community). Again, no idea if this is the case, but comparing the C APIs of Ruby and Lua, it's a huge difference.
- roryrjb 7y agoThis is a big use case for me. I really want to use Perl but I favour Python because the CPython API vs XS, it's a no brainer. I haven't really looked into the Ruby C API but if it's sane I would use it as well.
- AdieuToLogic 7y ago> I really want to use Perl but I favour Python because the CPython API vs XS, it's a no brainer. As I just mentioned in this thread, there is a project called SWIG[0] which might be something you'd want to check out. 0 - http://swig.org/ http://swig.org/
- roryrjb 7y agoThank you. I've heard of it and read about it a few times but haven't seriously considered it, but I will.
- lizmat 7y agoPerhaps Raku is an alternative for you with its Perl roots and its NativeCall support: https://docs.raku.org/language/nativecall https://docs.raku.org/language/nativecall Also see this recent blog post for interfacing with C++ and Fortran from Raku: https://andrewshitov.com/2020/01/08/calling-cpp-and-fortran-functions-from-raku-using-the-nativecall-interface/ https://andrewshitov.com/2020/01/08/calling-cpp-and-fortran-...
- zmmmmm 7y agoThat's why I actually do a lot of my data science work with Groovy. I just find Python awkward, frustrating and way underpowered as a language (both in terms of language itself but, of course performance as soon as you need to implement anything and not just glue other things together). Groovy + JVM accessible numerical libraries (Smile, ND4J etc) actually make a pretty good combination, even if you do not have access to the state of the art stuff that is going on in R / Python.
- coldtea 7y ago>I just find Python awkward, frustrating and way underpowered as a language (both in terms of language itself but, of course performance as soon as you need to implement anything and not just glue other things together). Compared to Groovy and Java?
- zmmmmm 7y agoGroovy absolutely. Java is .... Java.
- jtms 7y agoI wrote Ruby as my primary language professionally for over 10 years. These last few years though I write more python and javascript than anything else, but damn do I miss the joy of full time Ruby - what a beautiful, pleasant, productive language it is!
- IfOnlyYouKnew 7y agoAgreed... I can write typical data-wrangling code at close to the speed of typing in ruby. In Python it takes forever, and I notice how every fibre of my soul tries to avoid even looking at it, much less enjoying and wanting to learn. But it didn't turn out that way. And since people using Python don't strike me as particularly stupid or anything, there must be something about that language I'm still missing, or it wouldn't have succeeded as it did. I do insist, however, that the documentation is overseen by sadists. Half the time the first 10 hits are to the C interface. The others sometimes link circularly between two "see: x" declarations, etc.
- kjeetgill 7y ago> I can write typical data-wrangling code at close to the speed of typing in ruby. In Python it takes forever, and I notice how every fibre of my soul tries to avoid even looking at it, much less enjoying and wanting to learn. See I can say the same thing in reverse. I suspect it's just frustrating that once you know one of the two well, the other just dosen't do enough different to be worth learning as much. They have plenty of differences in the specifics but they're incredible similar in the domains they shine in. Similarly between Java and C#. Add to that the fact that Python is now so established and used so many domains that the package availability that it attracts so many more people as a first language. That said, I do do have reasons I prefer python, though I doubt they're solely why it "won". Idiomatic Python is just much clearer and more straight forward for most. They explicitly spent time to minimize how many language concepts and constructs you need to get basic things done. Compare: some_list.each do |this_item| puts this_time end for this_item in some_list: print(this_time) The syntax/grammar are often more regular, use keywords and fewer symbols, and optional bits. Python went through a heavy monkey-patching phase (that's all but rejected now) but never went full blown DSL-style like Ruby. I'd say they both gained popularity being fun to write languages but Python stayed a but more balanced in readability. ps: parens are better on function calls. fight me.
- wrinklytidbits 7y ago> some_list.each do |this_item| puts this_time end > for this_item in some_list: print(this_time) Just a nitpick: for one liners you can write: some_list.each { |this_time| puts this_time }
- namelosw 7y agoAnd also, a decade before the Ruby community was the most inspiring community. One can really learn a lot from others, every day. It was like a hacker sanctuary while most programmers are still debating Java vs C++/C#. Now the community is scattered into different communities - JavaScript, Go, Python, Rust, Scala, Elixir, etc. Those communities are still quite good, but none of them is as great as the previous Ruby community, or at least, gives me the same feeling IMHO.
- sanderjd 7y agoI agree with this. I did rails for a long time and honestly became pretty disenchanted on Ruby as a web services platform. But now that I interact with data analyses in Python fairly regularly (because they are everywhere) I really miss Ruby. I wish Ruby had landed on a different killer app!
- jimbokun 7y agoDoes Julia scratch that itch now?
- totalperspectiv 7y agoIt's not on the same level as the R Python ecosystem, but you should check out Scala. It has the power and flexibility, but also a fairly solid backbone of data science libs.
- nnq 7y agoDoes it have (1) a RELP, (2) jupyter support and/or smth like it, (3) interpreted mode or a compiler fast enough that I can pretend it does not exist? Without these it might be a a powerful tool, but it wouldn't be in the same niche as Python and R. Also, having touched Scala once before, the complexity and learning curve, and the prerequisite of being knowledgeable about JVM ecosystem to be productive in it...
- totalperspectiv 7y ago1) yes: https://docs.scala-lang.org/overviews/repl/overview.html https://docs.scala-lang.org/overviews/repl/overview.html 2) yes: https://almond.sh/ https://almond.sh/, there are other options as well 3) The compile times don't bother me. I just set up sbt to watch for files saves and run tests. I'd say the dev cycle is faster than python due to compile time type checking. It's not the same as Python or R, you are right. There is complexity, but it's rewarding once you get past the initial curve. I felt similarity regarding the JVM, but again, it's not that bad. Plus with GraalVM you can compile binaries, which I love for so many reasons.
- sergiotapia 7y agoRuby was fun while I worked with it professionally but now I don't really like it or reach for it. It's a combination of monkey patching, imports being affected by their filesystem location, games of is this a function or a variable. I don't miss it. I've been working with Elixir for the past three years and it's boring and predictable. I want that moving forward from my tools. I want boring and predictable.
- deleted 7y ago[deleted]
- vmchale 7y ago> Every time I read Ruby code it almost puts a smile on my face, it seems such a joy to write and think in Compared to Haskell, its performance is not good. Same with J for that matter.
- jhoechtl 7y agoMarv, yarv - how is the most downloaded standard implementation called before the language cops bite - is just so unbearably slow for anything besides gluing things together. After that many years it still leaves me baffling how such a mediocre implementation is still actually accepted by it's community. The language is nice though. I wouldn't vote for the everything is an object paradigm today.
- davidw 7y agoPython may be faster than Ruby, but it's not "C" faster. It's the language extensions like NumPy that do the heavy lifting, and those are usually written in compiled languages like, say, C.