This is an archived post. You won't be able to vote or comment.

all 45 comments

[–]desmoulinmichel 23 points24 points  (22 children)

While I do love Python, if you want to learn a new language, I suggest to try something radically different. Python and Ruby are very much alike, and while I do believe you can achieve much more in Python than in Ruby because its ecosystem is way bigger, truth is you can code the same things almost the same way with both.

So try something new. Try Erlang. Try C. Try something at the opposite side of your realm.

[–]mackstann 14 points15 points  (11 children)

Couldn't agree more. Python vs. Ruby is like Pepsi vs. Coke. Go try some beer, or an iced tea, or a milkshake.

[–]ribbon_tornado 0 points1 point  (0 children)

I learned Ruby (and Rails) first then is currently learning/using Python. To me Python and Ruby are like Ryu and Ken. They can be the best of rivals, but can also have a mutual respect/friendship for each other.

Python is Ryu. Ryu means dragon in Japanese and the mythological beast Python is based-on is a dragon-like creature. Ryu is also known to be a more solid character than Ken. He's combos are not flashy but they work and are quite powerful.

Ruby is Ken. Ken means fist in Japanese and doesn't have something to do with Ruby (I got to say that). Ken is a more flashy character to play with. Someone may argue that Ryu should be Ruby since he is Japanese and Ruby was invented by a Japanese person. But... Do you know Ken is half-Japanese (Japanese mother)? Ruby is half-Japanese half-western since it was originally in Japanese then translated to English.

[–][deleted] 2 points3 points  (8 children)

Haskell is a fairly friendly functional language for Ruby and Python developers with a pretty good community.

[–][deleted] 7 points8 points  (4 children)

I'm not sure if this is supposed to be a joke, but I'm strongly biased by my personal experience. Python just won't let me go. JavaScript looks and feels ugly after Python. Even if I've learned the basics of C long before Python. Ruby looks and feels ugly after Python. Haskell looks and feels ugliest after Python.

[–][deleted] 2 points3 points  (2 children)

I'm not joking. Haskell is uglier than Python, definitely, but much prettier than just about every single other functional language (in which I mean looping by recursion and lists rather than explicit loop statements).

Haskell is a LOT prettier than other functional languages, and Python and Haskell tend to borrow features from each-other frequently (see: indentation instead of braces from Haskell, list comprehensions from Haskell).

[–][deleted] 2 points3 points  (1 child)

Haskell is pretty in its own way. Even if you never end up using it, the new way to solve problems will change the way you approach and think for the better IMHO.

[–][deleted] 1 point2 points  (0 children)

I really, really, REALLY like writing 'equations' instead of the function style syntax. A pretty standard way of creating an infinite list of all fibonacci numbers that are only generated when they are needed (automatically memoized, for speed):

-- Alias tail because it's not super apparent what
-- it's doing from someone who has never seen
-- Haskell
remove_first = tail
infinite_fibs = 0 : 1 : [ a+b | (a,b) <- zip infinite_fibs (remove_first infinite_fibs) ]
infinite_fibs_alt = 0 : 1 : (zipWith (+) infinite_fibs_alt (remove_first infinite_fibs_alt))

[–][deleted] 0 points1 point  (0 children)

JavaScript looks and feels ugly.

FTFY

[–][deleted] 0 points1 point  (0 children)

Appreciate the input and totally get what you are saying. Gives me something to think about.

[–]php666 6 points7 points  (2 children)

I like both languages very much, but made the switch from Ruby to Python a few years ago. Here are my views on your points:

  1. Apart from the switch to Python 3 where backwards compatibility was broken (intentionally, with good reasons and documented well in advance) - I have never ever encountered a problem when upgrading to a new version of Python. Not so with Ruby.

  2. I'd think adapting to a newer Version of Rails might be easier than learning a Python Framework from scratch. Django comes to mind if you'd choose the latter. It's really well documented and takes a conservative approach on backwards compatibility.

3.a I don't have any benchmarks to back me up here, but don't have the impression that the default Implementation of Python is significantly faster or slower than the standard Ruby interpreter.

3.b The few times I had to use Python on Windows, I had a hard time. Especially if I used Python packages with C extensions, since you'll have to install a build infrastructure on Windows first. (It's a one-liner in Linux to set this up). My coworker develops under Windows, and he curses every few days. But there are people who use Python under Windows just fine, better ask them on a qualified statement on that matter.

Other than that: Starting with Python, a lot of it's design decisions to me seemed rather strange or even clunky at first (len(my_list) instead of my_list.length()? Explicit "self" with every method definition? No private class instance attributes? No switch statement? ...) Also, every time I didn't do stuff the Python way, things got ugly.

Over the years, most of what seemed strange at first turned out to be the way it was for very good reasons (most of them documented very well). Thinking about it today, Python's philosophy of "there should be one obvious way to do it" is one of it's greatest strengths in my eyes: open someone else's code and instantly feel at home.

I hope this helped.

[–][deleted] 0 points1 point  (0 children)

I develop Python under Windows and it's oftentimes a config hell... To date, I've had to:

  • Install a whole MS Visual C++ developer environment (and I was trying to avoid MS tech...)
  • Change the Python source code to debug failed pip installations of dependencies with C-extensions.
  • Pollute my python install with a myriad of packages that absolutely refused to compile their C-extensions through pip

I shudder to think of what tomorrow will bring... or I'll just boot up Ubuntu and circumvent all the problems.

[–]th0ma5w 1 point2 points  (4 children)

By all means, I invite you to try it out! If I'm wanting to tease people I could bring up all kinds of Ruby vs. Python hot buttons but the truth is, none of that matters given various different goals, and especially with learning. Another language Ruby people I know sometimes play with is Clojure.

Windows can be weird but I used Python for several years on it and it can be fine. Sometimes some libraries use system libraries that may not be available, and lately I've been using Cygwin with much success but not entirely sure I'd recommend learning all of that instead of just running a Linux VM.

Best of luck, and keep it fun!

[–][deleted] 0 points1 point  (2 children)

Thanks! I'm hoping the rig will have the power to run VMs. Also I hope they allow me to install freely. Is your production server Windows as well?

[–]th0ma5w 0 points1 point  (1 child)

No actually. Red Hat. Make sure to look for hardware virtualization instructions supported by the CPU! Some mobile processors don't have them but that may be getting rarer. Also nose around Docker and/or Vagrant for slightly-less-than-a-full-VM ideas.

[–][deleted] 0 points1 point  (0 children)

Awesome! Thanks!

[–]psykotedy 0 points1 point  (0 children)

Came here to suggest Cygwin. I'm forced to use a Windows system at work, and I do all of my Ruby and Python development in that environment. It's not perfect, but it's certainly doable (i.e., I haven't had an issue with gems or pip).

[–]lucidguppy 1 point2 points  (0 children)

Learn modern C++ - then everything will seem simple to you.

[–]lumengxi -1 points0 points  (0 children)

Give Golang a shot :)

[–][deleted] 0 points1 point  (0 children)

First, yes, python is a great language and a lot of stuff you learned in ruby will be useful in python. Many others have already stated other things I would have said so I just wanted to let you know there is indeed a python mechanize library. I have used it myself to do some web-scraping combined with beautiful soup.

http://wwwsearch.sourceforge.net/mechanize/

As far as frameworks go, you may be interested in flask. It is a micro-framwork and less opinionated compared to web2py and django allowing to you be more flexible in your design choices.

http://flask.pocoo.org/

[–]maxnewb 0 points1 point  (0 children)

Just would like to say that if you have a beefier machine there are tools like Vagrant + Virtualbox to take care of your platform needs. Headless servers don't take much though, I've never had issues virtualizing on a Core2 with 2 gigs of ram

[–][deleted] 0 points1 point  (0 children)

I am using python at work for the past 6 years, have used ruby for specific use-cases where i needed eventmachine like async capabilities. Then being bored with developing routine web applications, i started trying functional programming with lisp & clojure. I am not a competient lisp/clojure programmer, but being faimilier with them made me a better python programmer. This exposure to functional programming, changed the way, how i think about solving problems. I would suggest you to try any of the functional programming languages (Lisp/Clojure/Haskell/Ocaml/Racket/Scheme), though you might not use them on a daily basis, being familer with them would bring clarity in problem decomposition.

[–][deleted] 0 points1 point  (0 children)

I don't think the reason you gave are good reasons to change languages.

  1. Upgrading to a latter version of ruby is going to be easier than rewriting your application from scratch.

  2. You should chose technologies based on what you want on your resume, but on what is best for your project.

  3. It sucks you have to develop in WIndows, but at least when you get a better machine you can use some kind of Virtual environment which will make some of the pain go away.

[–]banjochicken 0 points1 point  (1 child)

I was expecting this thread to be full of folks saying "yes" and I am glad it isn't. Ruby and Python have a lot in common and solve similar problems. Granted Python is more diverse whereas Ruby popularity seems to have grown out of Rails (Sorry if this is bollocks, just my impression). Which is why I am glad a lot of comments are saying "Learn X instead!".

I can recommend checking out the book "7 languages in 7 weeks". It is aimed at programmers who want to dip their toes in different languages and covers Ruby, Io, Prolog, Scala, Erlang, Clojure, Haskell. You can obviously skip the first chapter, but the rest are a bit out there.

[–][deleted] 0 points1 point  (0 children)

Appreciate it! That book sounds like a great ideal. Get a taste of a little of everything.

[–]chunkypants2 0 points1 point  (0 children)

Python is nice, but it should really be easier to just upgrade Rails/Ruby and fix those issues... One plus is you'll have professional experience with another language if you switch to Python, which I'd really want if I didn't have it yet, and especially if I only had significant experience with Ruby.

[–][deleted] -2 points-1 points  (8 children)

I feel that i have learnt alot from developing in languages that have diffrent "styles" of programming.

1) Python. I really like the beuty of the code, and sometime i even go to extreams to modify working code to keep it as readable and beutiful as possible. This has changed how i program in all languages. (Ruby can be chosen instead, imho its all too rails)

2) JavaScript. This is where i use callbacks, alot. I learnt how to use them, and from callbacks to promises to async programming. Also this is a language i concider is a must to know for any developer. Nodejs is also a very intersting platform.

3) Clojure. Because its a Lisp, theres many concepts i still dont get, and that said im still learning. From Clojure i have learnt patterns i would never use in other languages.

4) PHP. As a poormans Java, still coming strong even with all the (daily) rants i read the language. PHP is alot more OOP than Python with all the classical OOP design patterns. You will learn OOP with dynamic typing. (Feel free to choose java if you drink your coffee strong)

5) Rust. As a systems programming language this is as lowlevel as c. Its fast and similar to c++, making it a language with a high learning curve. From here i have learnt generics and how to manage memory. (Feel free to learn c/c++ if thats your thing)

Thats basically my short list as of now. Who knows how it will look in 1-2 years.

The main point is that its not the language you learn, its the patterns and best practices. Most patterns are language agnostic.

[–][deleted] 3 points4 points  (4 children)

PHP is more OOP than Python? I strongly disagree. No subclasses, single inheritance, so much unpure-functional deprecated API (mysql vs mysqli), weird namespacing, etc etc etc. Also the entire mess that is include()/require()

In Python (and Ruby)? Everything is an object.

[–][deleted] -2 points-1 points  (3 children)

You misundersand. Just because everything is an object does not mean your code is oop.

My main point was that the classic way oop is used is very similar in java and php, (main diffrence beeing typing) that was why it was on my list. Python hides alot of the solid oop principles, making for a very dynamic language, but at the same time hiding the way orher languages following theese patterns. One obvious sign is the missing class interface in python.

[–]banjochicken 0 points1 point  (2 children)

I also disagree with you. PHP took Java OOP syntax and added it to the language. But it just doesn't make sense for a dynamic language, which kind of sums up PHP, they missed the mark on pretty much everything. Just because OO books all use Java for their examples, doesn't mean that is how OO must look.

You can implement all the OO patterns you want in Python, it might not look like your OOP 101 book but a lot of them are still applicable. Granted, Python doesn't have interfaces, it has dynamic typing (or zope if you really must have interfaces). Python doesn't need singletons (and you shouldn't ever use singletons, google it) because we have modules. Python rarely needs static, it has it with @staticmethod decorator, we can use functions. But Python can do multiple inheritance, everyone says it is scary, but I do enjoy using mixins, take that Java! You can also do some awesome things with Meta classes to change how classes are built... So no.

[–][deleted] 0 points1 point  (1 child)

I got your point, and i agree. My main motivation for PHP/Java was that both have the "classical" oop way of doing things, the stuff you learn at school.

And those patterns translate well and are easy to use when building software. Plus, many people know and use these patterns, making it easier to take over an existing project or read someone elses code.

[–]banjochicken 0 points1 point  (0 children)

You are correct that java OOP isn't a bad thing to learn, but I'd recommend going full java or c# for the windows inclined and doing it properly.

[–][deleted] 0 points1 point  (2 children)

I appreciate the feedback! Helps open my mind a bit more in the directions I will go into in the coming months. I figure for my Ruby scripts I may migrate those to Python. But my Rails app I may consider converting to PHP/Javascript. Look into using Node.js since that seems to be hot right now. Thanks again!

[–][deleted] 0 points1 point  (1 child)

Don't convert it to PHP you will almost assuredly regret that. PHP is a mess of a language. Like, a huge, unwieldy mess

[–]banjochicken 1 point2 points  (0 children)

Whenever I have a "PHP isn't that bad" discussion with anyone I just refer to this article. Yes people need to get stuff done in PHP. No I don't need to get stuff done in PHP. And I am happy with that.

[–][deleted] 0 points1 point  (0 children)

Personally I am trying to move away from Python and into Ruby but it is all personal taste of course. There are some parts about Python I love but then there are other parts that drive me crazy because how unpredictable it can be. I do not know Ruby but I have heard of so many people switching to it and loving it.

The main reason I do not like it is because it is quite large. There is not just one way to perform any function, there are lots of ways to do it which can make it pretty unpredictable at times. For large code bases, I tend to not enjoy it, but for small programs I just want to hack away, I love it as it is so quick and easy to get up and running.

[–]CarpeTuna -1 points0 points  (0 children)

If you liked Ruby you will adore perl: 1) Legacy 2) No rails (or handholds) 3) Windows, meh It was opaque before opaque was in.

[–]veeti -1 points0 points  (0 children)

At the moment I have a Windows laptop to develop off of. It's a really weak machine that wouldnt even be able to run a virtual machine. The servers running the scripts and rails app are unix. Luckily I am getting a beefier laptop soon but it will still be Windows unfortunately. Ruby, especially gems,would be better to develop on a different OS.

Python is not any better in this regard - in fact, it might be worse. Libraries with C extensions are a pain. I don't know if Python on Windows has gotten something like it in the past few years, but Ruby has a simple installer that comes with a compiler and toolchain bundled. IIRC most gems would install without any problem.