From: Austin Ziegler Date: 2005-12-22T02:15:31+09:00 Subject: Re: Why not Python? (No, no, I am not a spy) On 21/12/05, Tolga wrote: > First of all and very first of all, I must state that I am not an > enemy or a spy :-D > > One or two weeks ago, I tried Python and loved it. But I also hearing > ineteresting things about Ruby nowadays. Which language should I use? Whichever one makes you happier. > Oh, yes, this question looks somewhat silly, this is a Ruby group and > people will tend to give an automatic "Ruby" reply. But as far as I > see, Ruby (and Python) has a intellectual community. So, I hope that I > will get logical explanations rather than "holigan" cries. > By the way, I am not a computer scientist and these are the reasons > why I want to learn Python or Ruby. Please consider them when > replying: > 1. I am not a computer scientist. > 2. I AM interested in artificial intelligence and this is the major > reason for me to learn a programming language. > 3. I am familiar, but not experienced, in BASIC, C/C++, Java, Prolog > and Lisp. There are some people who prefer list comprehensions in Python, but find it less useful as a "functional" language overall. However, functions in Python are just that: functions. They are assignable and must be called with parenthesis: def foo: ... bar = foo # assigns the foo function to bar bar() # calls the foo function Ruby is fully OO, but is considered by some to have more "functional" features, but there are no functions (as such) in Ruby. they are all methods and they are not directly assignable. def foo ... end bar = foo # calls the foo method and assigns the result to bar bar = method(:foo) # assigns the method foo to bar bar[] # calls the foo method bar.call # calls the foo method There are other ways, but that's a distinct difference. Ruby, however, has blocks with closures and supports lambdas and currying very easily. This should be easily discovered; Mental is currently writing a series on doing Monads with Ruby and there's a lot of people doing what is perhaps best called "higher order Ruby" or "functional Ruby". > 4. I am *NOT* interested in web programming at all > 5. Nice GUIs always attract me. It is not mandatory but if Ruby can > provide me this (better than Python) I may immediately run to Ruby. Python probably has the advantage with wxPython; I have seen little movement in wxRuby lately, but Ruby does have strong support for Tk, the FOX toolkit (through FXRuby), GTK, QT (there's even a PDF book published about that). It also has Cocoa support for the Mac and native Win32 MFC support on Windows through VisualuRuby and SWin. > 6. And finally, what is "Rails"? Do I have to learn it if I dive into > Ruby? Does it necessary for only web? No, you don't need to learn it. You need to learn Ruby if you want to really do Rails. Rails is an end-to-end web application stack that provides web-to-database CRUD application support very inexpensively. It also supports some level of email handling and other things, but it's divided into subprojects such that Rails itself is mostly just a collection of scripts that uses the subprojects to lay out applications in a very opinionated way. -austin -- Austin Ziegler * halostatue@gmail.com * Alternate: austin@halostatue.ca