Ruby or Python?
-
So I'm thinking about learning one of these, primarily (at this time) for my own edification/amusement. Which should it be?
Also, in either case, what's a good way to learn it, that isn't something like whinge's poignant guide? I know a bunch of languages already, I don't need a gentle introduction to programming, I (mainly) just wanna learn how to write in this lang.
-
Python is pretty easy to get into. Ruby is tricky though I've never dealt with pure Ruby, only Ruby on Rails. It took me and my hosting provider two full weeks to get a Ruby on Rails app up and running (I lol at Passenger/Rails "It Just Works" slogan).
Python is also reasonably cross-compatible between Linux and Windows environments.
-
So...that's one vote for Python AND Ruby. That was certainly helpful.
-
Who voted Ruby? I thought I was bashing it.
-
Ah, comprehension fail. I must have been assuming you were only panning Rails.
-
python here.
i may have drifted away from it to the cozy embrace of NodeJS but that's only because i enjoy a good WTF myself too. :-D
-
I think Ruby's the way to go, but it's kind of neck-and-neck.
-
I think Ruby's the way to go, but it's kind of neck-and-neck.
Well, now that you've weighed in, it is.
-
i count 2 for python, one for ruby.... unless i missed someone?
-
That's only one more vote for one than for the other, though.
-
it's still a 50% lead though!
-
What the hell kind of "smiley" is that?
:smileyodon:
-
I use Python. I tried to get into Ruby because of the massive ecosystem but I absolutely hated how there were 50 ways to do the same thing in the Standard Library. It's also ridiculously slow.
-
it's after it had a night of with
-
:heart_attack_eyebrows:
---
Filed under: First and Last
-
Well, now that you've weighed in, it is.
OH NOES!
Well to explain myself:
-
Python I think might (that's a big "might") be a better-designed language, BUT it has bad issues right now-- the 2.7 -> 3.0 split, that's a huge issue. The disorganized libraries (urllib, urllib2, urllib3), where some of them are decades-old (and some things don't have solutions at all-- try to find a working SOAP library for example.)
-
Ruby is probably a less clean design, which frequently has 47 different ways to do anything in the language and no guidance as to which way is "best" (assuming any are). It's slower-performing, and its threading support is (somehow) even shittier than Python's. But its libraries are pretty solid and up-to-date, and without the whole "incompatible version split" idiocy there's a good chance the libraries will actually improve over time and not become even more out-dated and poorly-organized.
Both are about on-par with tool quality.
If I were picking one today, I'd pick Ruby. Python just "feels old", for lack of a better way to put it, and the version split means it's not likely to improve anytime soon. Ruby also seems more "web-ready", meaning it's easier to hook your Ruby up to a web server even if you don't use a big framework like Rails.
-
-
OH NOES!
That was just a joke because your vote is the one that made it not-lopsided.
-
BUT it has bad issues right now-- the 2.7 -> 3.0 split, that's a huge issue.
Agree with blakey with this right now, and it doesn't look like that split is going away any time soon.
not that that changes my vote
-
I'd say Ruby because it sounds like fun in a way Python doesn't.
But WTF would I know? I haven't managed to break out of PHP yet
-
Ruby sounds, I will admit, more interesting to me because of the differences from more "normal" algol-based languages.
-
Personally I prefer Ruby's syntax although the blocks/lambdas can be confusing. I have dabbled in Python and found it really good, but since I like Rails over any of the Python frameworks for web development I tend to lean more towards Ruby. if I wasn't interested in Rails and wanted something for scripting, I'd probably go the Python route but since I do like Rails and want to learn it, I like Ruby.
-
I've been looking into the same thing myself lately.
I went with python.The main reason is: python has versatility. There are all sorts of things being done in python; web stuff, system tools, games, desktop apps etc. Go into any server and there is bound to be some python there.
While Ruby has support for various different things, it didn't actually do anything outside of the web world. Where is a ruby game or desktop app or must have system utility? Going into it would feel slightly like locking myself into a rails/sinatra ghetto.
And then, there's the speed issue too. It was a problem a decade ago. It's still a problem today. Things don't seem to be improving at all. The python version 2/3 split will be forgotten in 5 years. Ruby, it seems, will remain the slow pig it is today.
-
I can't really add anything overly productive to this except to say that, like @mott555, my experience with Ruby is linked to Rails, and Rails/Passenger can fuck off and die.
I like Python, personally.
-
... it [Ruby] didn't actually do anything outside of the web world. Where is a ruby game or desktop app or must have system utility?
Around here, most of our workflow is scripted, and people tend to use whatever language they know or like best to get the job done, mostly Perl or Python. However, the person who wrote our main script for running tests decided to do it in Ruby ā I suppose because it's hip and/or he wanted an excuse to learn it. So there's one non-web application. Maybe the only one, but there is one.
Ruby, it seems, will remain the slow pig it is today.
I don't know whether the blame belongs to Ruby or inefficient coding, but it is slow.
-
I wouldn't choose either Python or Ruby. (I am partisan, but for neither side.)
My objections to Python stem from the way it exposes far too many things that ought to be concealed. (The CPython implementation is shitty in the threading department too, but that's an issue with the particular implementation.) The 2/3 split is also worrisome, especially as it has gone on for so long and seems to be likely to continue a while longer. (It's not as bad as the Perl6 debacle, but even so.)
My objections to Ruby stem from the āhidden landmineā side of things. If you can keep everything as a single encoding (and not one of those weird CJK shift encodings) then everything is OK, but otherwise things get very painful; @sam has been finding this out the hard way, and it's indicative of a fundamental lack of wisdom applied to the fundamental operations in the language. It's also slow, probably because of making everything be an object and using a fairly complex dispatch mechanism (those things are hard to optimise).
Both languages have some nice things (PyPy, Rubygems) but neither's hit programming language nirvana.
-
Both languages have some nice things (PyPy, Rubygems) but neither's hit programming language nirvana.
I think we've conclusively decided the closest to programming nirvana is C#.
-
I've never used Ruby for more than five minutes. With that said, I believe Python is a much mature platform and has more usages than Ruby. For example, although I'm sure there are bindings for Ruby too, Python has bindings for GTK, Qt, wxWidgets. There are at least 3 great web frameworks for Python (Django, Flask, Pyramid). For some reason Python is extensively used by other fields like scientists and statisticians.
It's a default installation in any *nix server (Ruby is not) for several years now.
I guess that if it's something you want to keep in your tool belt for future usages, Python is the way to go.
Also, virtual-env is a great feature of Python (not sure if Ruby has something like that).
-
Also, virtual-env is a great feature of Python (not sure if Ruby has something like that).
rvm. They have good tooling on nix, no doubt. But your other points stand.
-
My vote goes to Python, though it's mostly because I got burned at one time using Ruby.
I wanted to mess around with scripting something about file rollover or so and tried to use Ruby's time support. I can't remember why I wanted to use ISO 8601 formatting, but tried it anyway. So you go Google for it and you find the Time "core" class. If you search on that page you see there's a sample for the round method where they use ISO formatting but this function isn't defined for the Time class.
Here I got confused and hit Google again to find the time library. For your amusement I copied the description of that library:
When ātimeā is required, Time is extended with additional methods for parsing and converting Times.
And that's when it hit me what kind of WTFery exists in Ruby; the stdlib is extending a core class. Talk about being self-documenting...
Oh, and not that anyone really cares, back in 2008 Jeff was also saying that monkeypatching is Doing It Wrong ā¢. I wonder if he switched sides twice in the mean time.
-
-
And that's when it hit me what kind of WTFery exists in Ruby; the stdlib is extending a core class. Talk about being self-documenting...
Javascript has been getting away from that shit for years.
In my huge node project, I have one date-time library that extends the base Date object. It's SUPER annoying to use. You're never sure what method will work. IDE is completely helpless to determine anything about the stuff you type. I should have gone with moment.js.
Monkeypatching sucks.
-
My vote goes to Python as well; the 2.7/3.x divide isn't so bad as long as you aren't trying to support 3.0-3.2 (which have some degree of gratuitous incompatibility with 2.7) or a pre-2.7 2.x version, and it's a far more mature language with bindings or libraries for most tasks, whether they be hipster Web things, stodgy old desktop apps, or crazy mad-scientist jobs. Granted, Python has basically 0 threading support, but that's not really a drawback, considering that most people have a hyper-myopic, hyper-skewed view of threading, anyway.
Filed under: forking processes for parallelism has been an option for how long now?
-
Granted, Python has basically 0 threading support
No, it would be better if it had 0 threading support. Any code where you can speed it up by running a do-nothing busyloop in parallel is deeply WTF-worthy.
-
. Granted, Python has basically 0 threading support, but that's not really a drawback, considering that most people have a hyper-myopic, hyper-skewed view of threading, anyway.
https://docs.python.org/3.1/library/threading.html#thread-objects?
it does threading just fine!
-
Any code where you can speed it up by running a do-nothing busyloop in parallel is deeply WTF-worthy.
.... got an example for me? cause i wanna see that.
-
Python has basically 0 threading support
Can you compare this statement with Ruby threading support? I really don't care, I wouldn't use threading with a dynamic language, but I believe it would bring more to the conversation.
-
.... got an example for me? cause i wanna see that.
David Beazley did the legwork; I just read about it. I hope to god that things have improved since thenā¦
-
Can you compare this statement with Ruby threading support? I really don't care, I wouldn't use threading with a dynamic language, but I believe it would bring more to the conversation.
Python has the GIL aka Global Interpreter Lock. I.E. no two pieces of code can be in the Python interpreter itself at the same time. In other words, this:
https://docs.python.org/3.1/library/threading.html#thread-objects?
it does threading just fine!
is useless from a practical standpoint.
Fortunately, Python's support for process-juggling is quite good (unlike some languages: Java, I'm looking at you! *frystare*), and there are also mature libraries for event-based async programming -- Twisted has been production-quality since before Node.js was invented.
-
is useless from a practical standpoint.
for CPU bound tasks, yes. for IO bound tasks not so much.
i multithread my web scraping scripts all the time because they are so IO bound that the GIL never bites me (too hard); and if i'm doing CPU bound work i'm usually not using Python because i don't want to have the overhead of interpreted language (i usually reach for C++ or C# depending on what platform i'm on at the time)
-
David Beazley did the legwork; I just read about it. I hope to god that things have improved since thenā¦
It was apparently fixed in Python 3.2. But AFAIK Python 2.7 still has the old system.
Anyway, this fixes the performance problems on CPU-bound processing, but it does not allows Python code to run in parallel on two threads. Python threads have their uses, but running intensive calculations on multiples threads is not one of them.
-
Who voted Ruby? I thought I was bashing it.
You're not doing a very good job of it.
While Ruby has support for various different things, it didn't actually do anything outside of the web world. Where is a ruby game or desktop app or must have system utility? Going into it would feel slightly like locking myself into a rails/sinatra ghetto.
So your argument is basically don't use Ruby because no one else is using it?
-
So your argument is basically don't use Ruby [s]because no one else is using it[/s]because you'll have to reinvent a bunch of wheels to get anything other than webdev done?
FTFY
-
-
Now find me the Ruby equivalent of matplotlib...(TLTL)
-
Is there a moving goalposts badge?
-
There was talk of a "Blakeyrat" badge, but the goalposts kept moving to infinity and beyond.
-
Is there a moving goalposts badge?
I already knew that Ruby had RubyGems when I posted my FTFY, so no, the goalposts didn't shift one bit.
-
I see. In that case IHBT.
-
So your argument is basically don't use Ruby because no one else is using it?
Well... yeah. If you want to use ruby to solve problem X and no one else had used ruby to solve problem X, you're gonna have a bad time.
-
Ssh, @blakeyrat wasn't supposed to know about that badge.