Ruby or Python?

Which is the better language in the category of "languages that are used by cringy söyboys but also have extensive applications to serious programming"?

Attached: ruby-vs-python.jpg (800x600, 36K)

Other urls found in this thread:

github.com/sciruby/sciruby
twitter.com/SFWRedditGifs

Go, PHP, javascript, bash, C, C++, rust, Lua, etc
ruby & python were a mistake

Computers were a mistake.

I love python. The packages available just make it so easy to get a prototype working in barely a few hours. Have an idea for an algorithm? Implement it in 30 minutes tops, have access to a bunch of mathematical packages that make it super easy to do anything (with near c speed!), then even graph stuff about your algo with all the neat graphing tools. I understand that a language isn't defined by its packages, but it's definitely one of the big advantages of python. Forgoing the packages, it's still an enjoyable language to work in.

>python
>near c speed
what in the fuck?

Agriculture was a mistake.

I’ve used both extensively, ruby’s language design is by far superior imo. I hate white space sensitivity, also hate yml and coffee script for this very reason.

Package wise, I’ve never run into something I couldn’t find in the other language.

Community wise I feel the community for python has their head up their ass because they usually ONLY know python and think it’s gods gift to computing. In the ruby world, you’re sorta expected to know more than just ruby. People are less fanboy-esque.

All serious math libraries are implemented in c: pandas, numpy, all functions in the std math library etc.

That's because Ruby has no market share, so you have to know other languages. Python has enough market share that you could get by not knowing another language. e.g. you could pass Google interview and get a position using only Python but of course you'd be smart enough to learn a new language in a day anyway.

Ruby > Python but it's really more for comfort than quality.

That’s not true, ruby might not be as popular but it’s still very widely used. And good luck getting a python programmer to learn anything, usually they’ll just get salty.

Lua is significantly better than python, but out of those two shitfarts python is better.

As much as I dislike python’s lack of curly braces and retarded indentation shit, ruby is an abortion
Any language that allows inconsistent syntax is completely irredeemable.

Because if you use numpy, scipy, etc., all the serious math will be done inside the C extension, duh. It's a fine idea.

ruby is comfy
python is more useful i guess

i dislike how python has taken over, i'm old enough to remember when it was just a weird language not really used, like 2000-2005 or so

>PHP

Ruby is a very well designed scripting language, it has very solid OO where you always know how everything is scoped. Built-in functions in Ruby are very intuitive, well named. Classes and Modules work seamlessly as the Class class inherits from the module class so module scoping is working with class scoping. This is in sharp contrast to Python's silly virtual environments you need to create for its module system.

Ruby: Better designed.
Python: More libraries.

Lisp

Like others have said, certain libraries are implemented in C, but also that Cython allows you to compile Python, giving a 2x boost all on it's own. It also allows you to shove C in your Python scripts, allowing you to declare types, which can give something like 10-50x boost and bring it completely up to C speed.

Too bad OOP is hot shit for 99% of problems.

This. If you program recreationally, you need to know Python. It’s worth knowing for the Beautiful Soup library alone, imo. That being said I don’t particularly enjoy Python

Between these two python is actually a pretty decent language, it has some issues which makes working with e.g. with matrices more painful then it should be, but it's a fine language.

>The packages available just make it so easy to get a prototype working in barely a few hours. Have an idea for an algorithm? Implement it in 30 minutes tops, have access to a bunch of mathematical packages that make it super easy to do anything
MATLAB is a serious step ahead of python here, MATLAB has Matrices as a first class data type, which makes implementing algorithms smoother then in Python.

>with near c speed!
No, you don't get "near c speed". The longer and more complex your python program becomes the further away you will get from c speed.
If you want "c speed" you write your program in C.

python is also OO, just a shittier one

you prototype in python and if your prototype is not enough for production you rewrite it cleanly in go or ansi c

Attached: 0890 - NW9lOlw.jpg (396x398, 39K)

Python has actual closures and first class functions, unlike Ruby's proc shit.

Ruby does that too, and lambda expressions can take more than one line.

>but of course you'd be smart enough to learn a new language in a day anyway.
Do you actually believe this?
The only people that can pick up languages in a day are those that have already gone through the process of learning new languages enough times that they know what the "core" programming concepts are and what is unique about the language they are currently using.
If python is the only language you've ever used you're not going to have a fucking clue what is a core programming concept and what is a python-ism, and are going to be completely out of your depth for a good few weeks/month trying to learn another language.

PHP

Gouge my eyes out with chopsticks? Or pull my balls off with pliers?

>decisions decisions .......

This is the thing I don't get. You see the Python guys spending extra efforts to avoid nested for loops and write their code in vectorised form. But their vectorised oneliners are just compiled C code with nested for loops there.
Python and numpy are supposed to be simple but it is more convoluted to write than directly in C.

Attached: bin_cat.png (1024x768, 695K)

Lambda functions (arrow syntax) were only added in v1.9 of Ruby. The fact remains that blocks/procs are really weak and shitty to work with. It would be nice if they could get rid of blocks and replace it with lambdas

Because generally speaking if you're writing code in python then the core work isn't just the calculations. Perhaps youre downloading the data from somewhere or need to upload the results to a server, graph the data and export as PDF. All these things are trivial in python but a fucking pain-in-the-ass in c++ despite being 1000X faster to execute.

>are really weak and shitty to work with
Blocks and lambdas are one of the secret spices that make it so good. What's uncomfortable about it?

>Blocks and lambdas are one of the secret spices that make it so good.
no, blocks in Ruby are retarded, the just statically connect to a method, you cant pass them around without converting it to a proc, you dont know what youre talking about

>with near c speed
big hmm

Attached: fibonacci.png (751x941, 35K)

Read the post your responding to. The "near c speed" was pretty clearly referring to the mathematics libraries (eg numpy) in Python.

>Requiring libraries for faster math
That's how you know you should probably just use c.

Which also requires libraries for faster math.

Just write it yourself, don't be a brainlet.

Sorry, I don't have a couple of tens of thousand hours of time to create my own BLAS and LAPACKE implementations.

Every sane person uses libraries, spending your life time reinventing the wheel is genuinely retarded.

>That's how you know you should probably just use c.
Except using a slow, convenient language with a fast math library works very well. You don't have to deal with C's bullshit, but still get most of the performance.

>Except using a slow, convenient language with a fast math library works very well.
For small tasks yes, you don't actually want to use python if you care about speed.

>but still get most of the performance.
The smaller your program is the truer his becomes.

>ansi c
No.
C98 or 11

>you don't actually want to use python if you care about speed.
If calculation makes up the vast majority of your program's work, then why does it matter if you're using Python?

>The smaller your program is the truer his becomes.
No. The more calculation-heavy your program is the truer it becomes.

>If calculation makes up the vast majority of your program's work, then why does it matter if you're using Python?
Because there is a lot of overhead of the interpreter, every time you are using anything that isn't a direct call to a C library you will loose time compared to a C implementation.

>The more calculation-heavy your program is the truer it becomes.
This is absurd. If you are implementing something like GMRES in Python you are wasting a lot of time in interpreting it, although the calculations are all done in C.

>Because there is a lot of overhead of the interpreter, every time you are using anything that isn't a direct call to a C library you will loose time compared to a C implementation.
Sure, but how much time? An extra couple of hundred milliseconds across the whole application isn't going to matter.

>This is absurd.
Why? If the vast majority of work is happing in the mathematics library rather than in Python, than the slowness of the Python interpreter isn't going to matter much to the program as a whole.

>If you are implementing something like GMRES in Python
Why would anyone do that?

>An extra couple of hundred milliseconds
The longer the code is the worse it gets, a loosing hundred thousand times a thousand of a second adds up really quickly.

>the slowness of the Python interpreter isn't going to matter much to the program as a whole.
The more of the program is pythen the more it matters.

>Why would anyone do that?
That's the point of python, quick implementation to simulate results.

Web stuff: Ruby, - But python + django is "growing" while rails is "tapering off" I think because schools are teaching python now? So if popularity is important then pick python.
And node.js is now the "go to" for beginners, where it used to be ruby on rails, so if popularity is important skip both and just use JS for everything.

General programming stuff: Python, it's way easier to learn python than it is with ruby, things like CS50, MIT 6.0 etc all teach python and flask/django where as learning ruby is more of a DIY path to learning CS.
But I'm talking from a self-taught perspective.

You can also just try learn both, give each one a week or two and follow some online course to make a real-world example app in each, at worst you learn something about both languages and get a better understanding of things in general, at best you find out which one is perfect for you.

Wattafak
Ruby is the most elegant and comfy language there is, next to Haskell. A language shouldn't force you to do things in a certain way, and should not insult your intelligence and let you choose fit the way you want to do things.

Ruby has blocks, which work and are more intuitive than creating separate `def`s and/or having to use silly one line lambdas, then passing them in to another function.

I'm an avid user of python who almost exclusively programs with the intent of numerical methods & data analysis.

From my perspective, i want to spend the least amount of time possible programming, and python is usually good at accommodating this because numpy contains a lot of the tools to perform many of the computations i do on a day to day basis. If i had to do these "manually" within python, i would likely swap to a different (faster) language permanently, instead of only doing so when doing some heavy computation that isn't covered by the available, optimized libraries.

github.com/sciruby/sciruby

>Rust
>Lua
>Ruby and Python were a mistake

need something like mruby? Ruby it is. Need something like micropython (something entirely different)? Python it is.
Otherwise has it covered.

10 times better than python is

What is about Python in particular that triggers Jow Forums so much?

It's bad engineering on all fronts.

Forced indentation
The way it handles modules is fucking full on retarded

i like ruby more i'm sad it didn't get as popular as python.
maybe some day

Ruby is 'perl sucks, let's add OOP to it to fix it!'
Python is 'perl sucks, let's completely overhaul it!'

use pypy faggot

Still not nearly as fast for real life code. Not remotely. Same goes for everything JRuby9000/Graal-based.

Care to elaborate?

I still have no idea what Ruby really is and why it's used or semi-popular, what it's good/bad at, etc. In my 20 years of coding, it's just never came up.

You know, I've heard just the opposite. When I met with a tech recruiter, he told me "no matter what language you are know, we can find a job for you. Except Ruby. There are too many people who know learned Ruby and not enough jobs."

Could just be a regional thing, though. Like maybe some local trade school program pumping out underqualified Ruby programmers or something.