PDA

View Full Version : What's an easy language?



tsnell
September 26th, 2007, 09:37 PM
I'm just starting out programming and I was wondering, what would be an easy language to start with?

dhtseany
September 26th, 2007, 09:40 PM
What do you want to do with it?

Make webpages, programs?

BTW, my last Dad's name is Tom Snell haha

tsnell
September 26th, 2007, 09:54 PM
Programs
*lol that's cool about your last dad*

dhtseany
September 26th, 2007, 09:58 PM
From what I've read Python is a good place to start because alot of the commands are fool proof.

I like BASIC too because again it's all pretty straight forward.

Sean

tsnell
September 26th, 2007, 10:00 PM
thnx, do you know of any Free online tutorials? and where can I get a good python compiler?

wiscados
September 26th, 2007, 10:21 PM
python is interpered, not compiled...

it's normally installed by default...

if not:

sudo apt-get install python

the tutorial I use is http://www.freenetpages.co.uk/hp/alan.gauld/
It actually is a 3in1 tutorial VBScript JavaScript. and Python. First the subject is explained and and shown how it works in python, then it is shown in VBS+JS.

tsnell
September 26th, 2007, 10:23 PM
:oops: I didn't know it was interpreted:oops:

n e way thnx 4 the help!

Blue Sky
September 26th, 2007, 10:34 PM
Java

tsnell
September 26th, 2007, 10:42 PM
Java? I think I'll learn Python first after that, who knows?

Blue Sky
September 26th, 2007, 10:48 PM
With Java you will learn all the important OOP concepts, you won't be able to escape it. Python might be "easier" though.

jamespi
September 26th, 2007, 10:56 PM
http://programming-crash-course.com/

if you are just learning the fundamentals of programming it might be worth googling up a site specifically devoted to teaching you fundamentals.

The main learning languages historically were Pascal, BASIC and now Python. I taught myself BASIC when I was 9 by reading the User Manual for my Acorn Electron, so as you might tell it isn't very complicated.

Once you understand all the syntax of one language it's quite good to learn another. The more languages you learn the more fundamental concepts you'll grasp.

Java is a good place to move on to after Python or BASIC as it is a rather tidy elegant language. C++ is a total nightmare, ( Java is like domesticated C++ ). Plain old C is another good stepping stone if you want to start learning about low level programming. Then of course Assembler if you want to understand how your computer REALLY works.

I personally learnt BASIC, then Assembler when i was a teenager (bit of a jump I know) then Pascal at college, then Java at university (as well as dalliances with exotic languges like prolog and a functional language i cant remember the name of, then PHP at work (it's a toy language kind of pascal for websites - it isnt very good). Ive still yet to take the plunge with c or c++ but to be honest i dont have a reason to... next one on my list is python....

elst
September 26th, 2007, 11:12 PM
All popular modern programming languages are Object Orientated, so once you understand the concepts it is surprisingly easy to switch between them. Python, Ruby, C#, or Java are all OK. Perl, PHP, and VB are not so good.

If you are learning programming from no previous experience then the best first book that I've ever seen is "Learn to Program" by Chris Pine. That happens to use Ruby, which can be installed on Ubuntu with the usual apt-get.

I have mixed feelings about Java. On the one hand it does things in the correct and standard manner. On the other it is a bit tedious to actually do programming with it, so once you have learned the basics it's more fun to use Python or Ruby and get the results with less work.

jamespi
September 26th, 2007, 11:14 PM
http://wiki.python.org/moin/BeginnersGuide/Programmers

lot so stuff there but i dont know if it accounts for beginners to programming itself, or just python.

slavik
September 26th, 2007, 11:16 PM
easiest language evar: Scheme.

if you learn to program, first learn to program, then pick a language (ANY language, perl, C, python, etc. but in that order ;)) and then translate your programming.

the programming is a step by step instructions of how to do something.

for example: a simple calculator (2 numbers and an operation)

1. ask/get 2 numbers
2. ask/get an operation
3. perform the operation
4. output the result in some way

See? programming, and you can translate that in any language with any beginner howto for that language.

tsnell
September 26th, 2007, 11:44 PM
thnx 2 all of u 4 the 1nf0. 1'!! get bak 2 u l8r!

Wybiral
September 27th, 2007, 02:17 AM
The easiest language by-far is Brain**** (http://www.muppetlabs.com/~breadbox/bf/).

But you might want to do some searches around the forum before taking my word (or anyone else's). I hear google is a pretty good resource for information too.

kknd
September 27th, 2007, 04:50 AM
I suggest Lua, a free, simple, and fast script language (like Python). The interpreter have 150kb!

ButteBlues
September 27th, 2007, 05:41 AM
Ruby or Scheme.

pmasiar
September 27th, 2007, 01:03 PM
Python is the best.
Scheme has simple syntax, but language is rather non-trivial.
Ruby has too much perl inside to be simple.
BASIC and Pascal are too obsolete to be considered now, and VisualBasic is too complicated - has hundreds of reserved words, overbloated.

Wiki in my sig is full of links for Python learner, including training tasks. And find also LaRoza post, wiki in his sig is good source too.

starfry
September 27th, 2007, 01:19 PM
You could try Ruby on Rails

pmasiar
September 27th, 2007, 02:33 PM
Ruby on Rails is (a popular) web application framework, but if beginner starts with that, he has immediately two problems: (1) Ruby AND (2) Rails. IMNSHO much better and smoother start is writing command-line text-only programs.

LaRoza
September 27th, 2007, 04:37 PM
Read the stickies for links.

There are free resources for all languages, my wiki (in my sig) has many language tutorials, books and references.

ButteBlues
September 27th, 2007, 04:42 PM
Scheme has simple syntax, but language is rather non-trivial.

If it's good enough for MIT, it's good enough for me.

Word of advice though: if you want to learn Scheme, getting and reading The Little Schemer by Daniel P. Friedman and Matthais Felleisen should really be a pre-requisite.


Ruby has too much perl inside to be simple.

Nothing wrong with syntactic sugar.

LaRoza
September 27th, 2007, 05:01 PM
If it's good enough for MIT, it's good enough for me.
.

They use Python (I believe) for introductory courses.

ButteBlues
September 27th, 2007, 05:52 PM
They use Python (I believe) for introductory courses.
They've been teaching Scheme for a long, long time.

It was only last February-ish that they decided to use Python as the introductory language, which probably has more to do with the fact that their curriculum is now trying to find a happy medium between electrical engineering and computer science.

nss0000
September 27th, 2007, 06:04 PM
TSN:

I've just got back to programming myself -- I chose C as a first instance though I don't believe the choice makes much difference. Keeping an open mind and a focus on "local skills" will likely get you for'arder the fastest.

pmasiar
September 27th, 2007, 06:18 PM
If it's good enough for MIT, it's good enough for me.


I agree with you, but just FYI: MIT switched from Scheme to Python (http://www.oreillynet.com/xml/blog/2006/11/scheme_out_python_in_mit.html) and De-Scheming MIT? (http://lambda-the-ultimate.org/node/1840):-)

And it was not easy after all those years using Scheme, so Python must be SO much better than Scheme to be worth the pain I guess :-p

tsnell
September 27th, 2007, 06:59 PM
I think i will stick with python for now, I really like the IDLE(Python GUI)!
but thanx 4 the advice! if you have any other advice post it because I check the forums every weekday (and sometimes on weekends):)

LaRoza
September 27th, 2007, 07:03 PM
I think i will stick with python for now, I really like the IDLE(Python GUI)!
but thanx 4 the advice! if you have any other advice post it because I check the forums every weekday (and sometimes on weekends):)

After learning Python, you should look into languages like C, Lisp and Assembly for a better understanding of programming in general. Even if you don't use them, they are good to know.

My wiki has references for those languages, in case you want to browse them.

tsnell
September 27th, 2007, 07:09 PM
K thanx LaRoza

slavik
September 27th, 2007, 11:35 PM
I agree with you, but just FYI: MIT switched from Scheme to Python (http://www.oreillynet.com/xml/blog/2006/11/scheme_out_python_in_mit.html) and De-Scheming MIT? (http://lambda-the-ultimate.org/node/1840):-)

And it was not easy after all those years using Scheme, so Python must be SO much better than Scheme to be worth the pain I guess :-p
maybe the likes of you overran MIT? :-P

seriously though, computer languages have nothing to do with programming.

ButteBlues
September 28th, 2007, 12:08 AM
I agree with you, but just FYI: MIT switched from Scheme to Python (http://www.oreillynet.com/xml/blog/2006/11/scheme_out_python_in_mit.html) and De-Scheming MIT? (http://lambda-the-ultimate.org/node/1840):-)

And it was not easy after all those years using Scheme, so Python must be SO much better than Scheme to be worth the pain I guess :-p

The change was driven by the fact that the curriculum there has slowly evolved to have a balance between electrical engineering and computer science, so the Intro to CS classes try to teach both at the same time. It just so happens that the silly little robots or what-not can run Python - but I don't believe they did run Scheme. Fiscally, at that point, just teaching Python was the right choice.

However, for other curricula in which electrical engineering isn't really of concern, Scheme is still by far the best language for people to start with - though Ruby is certainly a fine choice as well.


Also, thanks for repeating what I had said an hour or so before. I'm sure it made a world of difference.

tsnell
September 28th, 2007, 12:42 AM
What type of programs is Python good for?

kknd
September 28th, 2007, 01:00 AM
What type of programs is Python good for?

Any program. Its good for the web, and its good for the desktop. But it's extremely slow for heavy calculus (in that case you can make the module in C and just control it in Python).

I still prefer Lua as a scripting language :)

tsnell
September 28th, 2007, 01:17 AM
thnx, i have been looking @ ruby and it seems that i prefer it to python, any1 know of any good ruby tutorials?

ButteBlues
September 28th, 2007, 01:41 AM
thnx, i have been looking @ ruby and it seems that i prefer it to python, any1 know of any good ruby tutorials?
If you don't mind something a little quirky, _why's (Poignant) Guide to Ruby (http://poignantguide.net/ruby/) is pretty good.

A far more in-depth analysis can be found in Programming Ruby: The Pragmatic Programmer's Guide (http://www.rubycentral.com/pickaxe/)

fng
September 28th, 2007, 11:59 AM
thnx, do you know of any Free online tutorials? and where can I get a good python compiler?

http://www.greenteapress.com/thinkpython/thinkPP.pdf

pmasiar
September 28th, 2007, 01:49 PM
maybe the likes of you overran MIT? :-P

If you mean, people who bothered to learn more than dozen languages good enough to write code in them, and know basic concepts of dozen more, studied languages comparatively, researched and compared how implementation on some basic principles (like types, exceptions, etc) is implemented in those languages, selected a language and then tested how real students fare in real life when solving programming tasks using that language - then sure, I would hope that such people over-run MIT. It is number one engineering school in the world for a reason.


seriously though, computer languages have nothing to do with programming.

I am not sure how you can be serious saying that. Only explanation is that your definition of being serious differs from common one:
http://www.answers.com/serious?cat=health&gwp=13

I was under impression that computer languages are related to programming, did I missed the change? And what exactly happened to severe the connection? :twisted:

pmasiar
September 28th, 2007, 01:56 PM
However, for other curricula in which electrical engineering isn't really of concern, Scheme is still by far the best language for people to start with - though Ruby is certainly a fine choice as well.

So Scheme or Ruby, but not Python, based on what? On not using "silly little robots"? And especially why Ruby but not Python? I looked into Ruby, it is OK but **way too close to Perl** for my tastes, so why you prefer Ruby over Python?

And why Scheme: functional programming is commonly seen as more complicated than simple procedural code, is your intention to weed out hacker weaklings using Scheme?


Also, thanks for repeating what I had said an hour or so before. I'm sure it made a world of difference.

Maybe not world, but just 2 links of difference :-)

Wybiral
September 28th, 2007, 02:28 PM
seriously though, computer languages have nothing to do with programming.

Seriously? So there's no major difference in idioms and design processes between languages? Anyone who learns something like Python or Perl can just jump right into something like assembly, because the difference in handling memory and defining data have nothing to do with programming?

I don't believe you.

LaRoza
September 28th, 2007, 02:38 PM
seriously though, computer languages have nothing to do with programming.

I think it was meant more like: "Computer languages are just tools". Programming itself means a more complete understanding than just a single language.

ButteBlues
September 28th, 2007, 04:30 PM
So Scheme or Ruby, but not Python, based on what? On not using "silly little robots"? And especially why Ruby but not Python? I looked into Ruby, it is OK but **way too close to Perl** for my tastes, so why you prefer Ruby over Python?

Ruby offers some wonderful syntactic sugar that Python doesn't. Ruby's usage of blocks, in addition to the way it handles instance variables, also make learning the language a bit more intuitive than Python.


And why Scheme: functional programming is commonly seen as more complicated than simple procedural code, is your intention to weed out hacker weaklings using Scheme?

Functional languages aren't harder at all. It's more complicated if one is not accustomed to it, but Scheme is most definitely one of the easiest languages to learn so long as you haven't already been taught the procedural way.

bruce89
September 28th, 2007, 04:45 PM
What's an easy language?

C, an awful lot easier than it sounds.

I looked at Python once and I nearly died in fright, it's pretty scary looking. Strange that people like it.

pmasiar
September 28th, 2007, 06:21 PM
Ruby's usage of blocks, in addition to the way it handles instance variables, also make learning the language a bit more intuitive than Python.

Can you link to some good description of Ruby's blocks? Are they some kind of closure? And how they are important for newbies and make life easier?

Also, just curious: How is handling instance variables different in Ruby vs Python? Do you mean it is a problem that Python has explicit self?


Functional languages aren't harder at all. It's more complicated if one is not accustomed to it, but Scheme is most definitely one of the easiest languages to learn so long as you haven't already been taught the procedural way.

Given that most people will need to learn some procedural language anyway, at least shell, I have hard time to buy this. Functional languages are so much more abstract, harder to comprehend IMHO. Do you have some empirical evidence that functional are as easy for beginners? Some links? All my experience tells me the opposite of your claims.

tsnell
September 28th, 2007, 07:26 PM
Can you link to some good description of Ruby's blocks? Are they some kind of closure? And how they are important for newbies and make life easier?


well, I believe Why's Poignant Guide to Ruby (http://qa.poignantguide.net) perfectly explains all aspects of Ruby. (although I am a beginner to programming I still can see the awesomeness of Ruby.)

sc30317
September 28th, 2007, 07:28 PM
Im learning ansi C for school, and finding it invaluable

Wybiral
September 28th, 2007, 07:53 PM
Are they some kind of closure? And how they are important for newbies and make life easier?

Yes, blocks are essentially a way of passing closures or lambdas.

Python can do the same thing, btw, it just doesn't have the same format that ruby has for it (as usually, ruby tends to take the much more wordy approach to describing it).


C, an awful lot easier than it sounds.

I looked at Python once and I nearly died in fright, it's pretty scary looking. Strange that people like it.

Python looks scary after all of the memory management, pointer juggling, lack of exceptions, and general wordiness of C? I like C, but I don't see how Python could possibly be more intimidating then C.

ButteBlues
September 28th, 2007, 08:05 PM
Can you link to some good description of Ruby's blocks? Are they some kind of closure? And how they are important for newbies and make life easier?

Here's a quick snippet to show you a usage of blocks in Ruby:



array = ['foo', 'bar', 'baz', 5]
array.each { |i| puts i }


That's a very simplistic demonstration, but the above would be used to output each term in the array. Of course, real usage cases are a bit more complex than that - and more useful.


Also, just curious: How is handling instance variables different in Ruby vs Python? Do you mean it is a problem that Python has explicit self?


One of the differences of Ruby compared to Python and Perl is that Ruby keeps all of its instance variables completely private to the class and only exposes them through accessor methods (attr_writer, attr_reader, etc). Unlike the "getter" and "setter" methods of other languages like C++ or Java, accessor methods in Ruby can be written with a single line of code. As invocation of these methods does not require the use of parentheses, it is trivial to change an instance variable into a full function, without modifying a single line of code or having to do any refactoring achieving similar functionality to C# and VB.NET property members. Python's property descriptors are similar, but come with a tradeoff in the development process. If one begins in Python by using a publicly exposed instance variable and later changes the implementation to use a private instance variable exposed through a property descriptor, code internal to the class may need to be adjusted to use the private variable rather than the public property. Ruby removes this design decision by forcing all instance variables to be private, but also provides a simple way to declare set and get methods. This is in keeping with the idea that in Ruby, one never directly accesses the internal members of a class from outside of it. Rather one passes a message to the class and receives a response.


Given that most people will need to learn some procedural language anyway, at least shell, I have hard time to buy this. Functional languages are so much more abstract, harder to comprehend IMHO. Do you have some empirical evidence that functional are as easy for beginners? Some links? All my experience tells me the opposite of your claims.

Scheme's role as a learning language is to teach the fundamental aspects of programming. The whole idea of functional vs. procedural doesn't enter the picture until far later on down the line.

In any respect, teaching people functional languages first is not at all difficult. "Links" on the matter would not offer definitive proof in any case - blog postings and what-not are subjective at best and are often written by everyone except those with years of experience in the matter.

ButteBlues
September 28th, 2007, 08:07 PM
Yes, blocks are essentially a way of passing closures or lambdas.

Python can do the same thing, btw, it just doesn't have the same format that ruby has for it (as usually, ruby tends to take the much more wordy approach to describing it).

Python's syntax and handling for blocks is kludgey at best.

Wybiral
September 28th, 2007, 08:41 PM
Python's syntax and handling for blocks is kludgey at best.

I had to look up the word kludgey (interestingly enough, the only definition I could find was from the urban dictionary: http://www.urbandictionary.com/define.php?term=kludgey).

I personally don't see any "kludge" in the use of lambdas or closures (or passing functions as parameters for that matter).

But, I assume "kludgey"ness is more of a personal preference issue anyway.

pmasiar
September 28th, 2007, 09:02 PM
well, I believe Why's Poignant Guide to Ruby (http://qa.poignantguide.net) perfectly explains all aspects of Ruby. (although I am a beginner to programming I still can see the awesomeness of Ruby.)

I tried to read it and was not able: the guy is way to opinionated and full of ego. It is not poignant but pointless :-) IMHO but YMMV. That book was one of the reason why I **don't** like Ruby, so... please any other book, or at least deep link to good explanation of blocks so I don't have to wade through the crap?

pmasiar
September 28th, 2007, 09:13 PM
array = ['foo', 'bar', 'baz', 5]
array.each { |i| puts i }


IIUC, Python has list comprehension for that:



array = ['foo', 'bar', 'baz', 5]
print [x for x in array]


You may call me biased, but Python version is more obvious to me. In Ruby, those strange || are just something inherited from Perl: just syntax decoration without any hint of meaning.

[quote]Scheme's role as a learning language is to teach the fundamental aspects of programming. The whole idea of functional vs. procedural doesn't enter the picture until far later on down the line.

It may work for mature audience, but 10 years old IMHO don't have patience for abstract concepts. So 'easy" depends also on audience.


In any respect, teaching people functional languages first is not at all difficult.

You again claim something what you cannot prove, refuse to support, and all other experts suggest otherwise. Is there some secret about teaching programming what you know and everyone else is missing?

pmasiar
September 28th, 2007, 09:26 PM
Ruby keeps all of its instance variables completely private to the class and only exposes them through accessor methods ... can be written with a single line of code. ... Ruby [is]... forcing all instance variables to be private

Python continues with good Perl tradition: programmers are consenting adults. If using attribute directly causes no harm, forcing getters/setters is unnecessary pain, and I don't see how it is good. I know Java religion says this pain is for good, but I don't buy it. KISS principle also may apply.


As invocation of these methods does not require the use of parentheses, it is trivial to change an instance variable into a full function,

So Ruby syntax has two ways to call a method, with parenthesis and without them? I am already confused.

pmasiar
September 28th, 2007, 09:30 PM
Python's syntax and handling for blocks is kludgey at best.

I guess we need to settle that "kludgey" is in eyes of beholder. In my opinion, Ruby is kludgey, and I have exactly as much proof for it as you have for your position, let's call it a draw? :-)

3-5 years from now, we will see which language would be more popular, and more popular **might** mean it is easier to learn.

bruce89
September 28th, 2007, 11:09 PM
Python looks scary after all of the memory management, pointer juggling, lack of exceptions, and general wordiness of C? I like C, but I don't see how Python could possibly be more intimidating then C.

All those "." and "_" things look yucky.

Anyway, Python seems silly as it is not compiled and so causes programs to be 10x slower than C (http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=gcc&lang2=python).

Funny how computers these days are faster, but modern programming languages are slower. Hopefully Vala (http://live.gnome.org/Vala) will be a good language to use in GNOME in the future. (it's a language like C#, but is translated into C/GObject before GCC compiling.)

Wybiral
September 28th, 2007, 11:46 PM
All those "." and "_" things look yucky.

You mean OOP? There's nothing scary or "yucky" about OOP.

C has those "."s that you're afraid of too, in its structures (which are just classes without methods).


Anyway, Python seems silly as it is not compiled and so causes programs to be 10x slower than C (http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=gcc&lang2=python).

Some code needs to be done in C, it's true (I do a lot of C programming myself).

But... Don't get me started on benchmarks. First off, you can't run the same code in two different languages because those languages have different idioms. You have to use the language as you would in real life (and Python makes heavy use of fast COMPILED libraries).

Not all problems are solved by fine tuning all the low level code. The really big problems have algorithmic solutions. You can cut out WAY more operations when you are able to abstractly look at complex problems from afar then you can just shaving things off at the assembly level.

C isn't better then Python... Python isn't better than C. I will repeat the phrase that every one of these "my language is better" wars boils down to and say "use the right tool for the right job".

When your job is learning a language or hacking out a manageable program quickly... Python may very well be one of the better tools. C has a place for lower-level code and is great for developing libraries, but as a C programmer myself I can vouch that Python is quicker to learn and start programming with.

tsnell
September 29th, 2007, 02:17 AM
"." and "_" make it fun!!! !_!

slavik
September 29th, 2007, 03:14 AM
Seriously? So there's no major difference in idioms and design processes between languages? Anyone who learns something like Python or Perl can just jump right into something like assembly, because the difference in handling memory and defining data have nothing to do with programming?

I don't believe you.
Look at LaRoza's response below yours. :)

Memory? Woah, I thought in Python there is no memory.

In a language like Haskel/Scheme/Prolog ... there is no machine (no types, etc). This is also one of the reasons why I/O is difficult in those.

And Brain**** is a much easier and smaller language than anything else around. The compiler is like only 167bytes or something of the sort. You can also learn everything there is about brain**** in about 5 minutes.

As for Python ... can you show me what the following regular expression would look like? s/((?:\d{1,3}\.){3}\d{1,3})/print $1."\n"/sge; (given a text file, the regex will parse out and print any/all IP addresses)

fleeb
September 29th, 2007, 05:06 AM
Har har... BF is 'simple' in the sense that a game of Go is simple, I suppose.

I expect some folks here might also recommend Intercal (http://catb.org/~esr/intercal/), for its data hiding capacity, and general politeness.

What's an easy language?

How about your shell?

You can string together a series of commands in a shell easily enough. If you aren't concerned about conditional expressions, manipulating data, and looping, it's trivial to program with your favourite shell.

And you don't even have to worry that much about memory management, since those poor folks who wrote the executables you're calling should have done that for you.

But this maybe underscores a point; do you care about doing something useful? And if so, what kind of 'useful' do you want to accomplish? The easiest language to use really depends upon what you're trying to do.

C or C++ is a trivial language to use if you need to write a device driver... certainly more trivial to use than Python.

Python (or any other of that lot, like Perl, Ruby, or whatever) looks nice for handling tasks that require loops, data manipulation, and conditional statements. Just tool around with a few languages until you find one as warped as yourself, and you'll do well.

Heck, for certain applications, sed might be just the right thing.

pmasiar
September 30th, 2007, 12:46 AM
All those "." and "_" things look yucky.

Anyway, Python seems silly as it is not compiled and so causes programs to be 10x slower than C (http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=gcc&lang2=python).

Those two sentences suggest that you do not have too much real-world experience. OOP is yucky, and you don't have any boss who would tell you taht the only speed that really matters in applications is **speed to the market**.

> Funny how computers these days are faster, but modern programming languages are slower.

Funny how some people worry about things which don't really matter to users.

slavik
September 30th, 2007, 07:09 AM
I have to agree with pmasiar. Python is as slow as what the interpreter can't figure out at compile time. Python is as compiled as is C, or Java, or Perl. Except Python's CPU has a different architecture than C/Perl/Java.


simple loop:
read number into x;
let y equal 0;
while y is less than x do:
print y
let y equal y+1
end while

in C/Java, even Perl the above will run to a max of what a 64bit double can hold. in Python (which uses bignum seamlesly) it will continue chugging without problems unless it runs out of space to store x and y.

misfitpierce
September 30th, 2007, 07:11 AM
English is pretty easy... I think ... Me no speaka da eng-lay... ?!?!?! :)

slavik
September 30th, 2007, 07:15 AM
Russian is way better than english ... start with that. (for those in doubt, in russian it very easy to show your mood by changing endings of words, or changing words around) :-\

in english, there is no "nice/caring" way to call someone a fool, in russian there is. :)

pmasiar
September 30th, 2007, 03:40 PM
As for Python ... can you show me what the following regular expression would look like? s/((?:\d{1,3}\.){3}\d{1,3})/print $1."\n"/sge; (given a text file, the regex will parse out and print any/all IP addresses)

IIUC, Python uses the same C regex library, module is called re, easy to remember :-) But I don't used it yet, simple matches was all i needed so far.

slavik
September 30th, 2007, 06:36 PM
and how do you do cancatenate something that is a number and a string? the plus operator doesn't work ... I thought Python wasn't a strongly typed language.

in perl:

$i = 5;
$j = "Hello";
print $i.$j; #or print "$i$j";

AFAIK, Python can't/doesn't do this.

Wybiral
September 30th, 2007, 10:50 PM
and how do you do cancatenate something that is a number and a string? the plus operator doesn't work ... I thought Python wasn't a strongly typed language.

in perl:

$i = 5;
$j = "Hello";
print $i.$j; #or print "$i$j";

AFAIK, Python can't/doesn't do this.

You're starting to sound militant!

I assume you mean "concatenate"...

As for the "+" operator, it concatenates strings and adds integers... Why should it default to the string behavior? Why doesn't 5+"100" result in 105?

Python isn't strongly typed, but it isn't typeless either. Variables aren't restricted to one type, but type conversion does exist (any language that supports OOP has to have some support for types or handling objects would get hairy).

For the situation above, there are a number of ways you could handle it in Python...



i = 5
j = "Hello"
print("%i%s"%(i,j))




i = 5
j = "Hello"
print(str(i)+j)




i = 5
j = "Hello"
print(i,j)

ButteBlues
October 1st, 2007, 02:49 AM
Python continues with good Perl tradition: programmers are consenting adults. If using attribute directly causes no harm, forcing getters/setters is unnecessary pain, and I don't see how it is good. I know Java religion says this pain is for good, but I don't buy it. KISS principle also may apply.

Being able to consent is no excuse for a flaw in the language.


So Ruby syntax has two ways to call a method, with parenthesis and without them? I am already confused.

Unlike in python, methods don't need to be invoked with '()' trailing to show the method is being called without any parameters. However, '()' are used in the case of parameters.


I guess we need to settle that "kludgey" is in eyes of beholder. In my opinion, Ruby is kludgey, and I have exactly as much proof for it as you have for your position, let's call it a draw? :-)

Python's syntax for blocks does a poor job of differentiating between a block and a method. That is why it's kludgey.


3-5 years from now, we will see which language would be more popular, and more popular **might** mean it is easier to learn.

Popularity means little. C++ is a very popular language, but it's pretty much an abomination as a learning language.


I had to look up the word kludgey (interestingly enough, the only definition I could find was from the urban dictionary: http://www.urbandictionary.com/define.php?term=kludgey).

I personally don't see any "kludge" in the use of lambdas or closures (or passing functions as parameters for that matter).

But, I assume "kludgey"ness is more of a personal preference issue anyway.

See my comment about this above - you missed the point. It is not that blocks or lambda's are kludgey, but rather, Python's implementation and syntax of the block is.


OOP is yucky, and you don't have any boss who would tell you taht the only speed that really matters in applications is **speed to the market**.

What are you smoking? It must be really quality stuff.


and how do you do cancatenate something that is a number and a string? the plus operator doesn't work ... I thought Python wasn't a strongly typed language.

in perl:

$i = 5;
$j = "Hello";
print $i.$j; #or print "$i$j";

AFAIK, Python can't/doesn't do this.

Ruby compromises in this regard:


i = 5
j = "Hello"
puts i.to_s + j

While Ruby doesn't randomly let you make use of the + method on an integer and a string, you can instead print the value of i converted to a string on the fly.

Fbot1
October 1st, 2007, 03:09 AM
In english, there is no "nice/caring" way to call someone a fool, in russian there is. :)

silly

slavik
October 1st, 2007, 05:45 AM
print(i,j) is not the same as concatenating i and j and then printing.

print reverse $i.$j is a different result from print reverse $i,$j;

ruby does what java does ... call the object's toString() method. which is what System.out.print() does implicitly when you use operator+() on a string and anything else;

wyb, the three examples you show still don't get close to Perl. in one you have to explicitly convert i to a string, in another you use a formatted print and in yet another you give it a list of things to print.

silly ... in Russian the nice version uses the same root but has a different ending, not a different word altogether.

Wybiral
October 1st, 2007, 06:16 AM
wyb, the three examples you show still don't get close to Perl. in one you have to explicitly convert i to a string, in another you use a formatted print and in yet another you give it a list of things to print.



print("%i%s"%(i,j))


This is NOT a formatted print. It is formatted string (which can be used to concatenate with other types), you may also say:



x = "%i%s" % (i, j)


I personally don't see whats wrong with casting it to a string... That's the only way you can "add" them, which is what the "+" operator implies. Like I said before, why do you think "100"+5 should equal "1005"? Why not 105?

The Zen of Python (by Tim Peters): "Explicit is better than implicit"

Natr0n
October 1st, 2007, 07:01 AM
Python isn't strongly typed, but it isn't typeless either. Variables aren't restricted to one type, but type conversion does exist (any language that supports OOP has to have some support for types or handling objects would get hairy).Python actually is strongly (http://docs.python.org/ref/objects.html) typed (http://www.diveintopython.org/getting_to_know_python/declaring_functions.html#d0e4188)
Your statement would have been correct if you had said:
Variables are restricted to one type, but type conversion does exist....

Wybiral
October 1st, 2007, 07:06 AM
Python actually is strongly (http://docs.python.org/ref/objects.html) typed (http://www.diveintopython.org/getting_to_know_python/declaring_functions.html#d0e4188)
Your statement would have been correct if you had said:

I didn't mean that they can be multiple types at once, I guess I should have said "variables are mutable/dynamically typed".

pmasiar
October 1st, 2007, 02:23 PM
and how do you do cancatenate something that is a number and a string? the plus operator doesn't work ... I thought Python wasn't a strongly typed language.

in perl:

$i = 5;
$j = "Hello";
print $i.$j; #or print "$i$j";

AFAIK, Python can't/doesn't do this.

Yes you can do it, but not in casual/random way Perl does it. Python is **strongly** but dynamically typed language. It is different from perl, what is weakly dynamically typed. Perl is willing and eager to transform values from one type to another without warning.

In Python, operator + requires either both numbers (for addition) or both strings (for concatenation). So you can do many things, but all are strongly typed:



h = 'hello'
n = 5
print h + str(n)
print '%s%i' % (h, n)
print h, n # values separated by space


Python is not Perl, Python has operator overloading , so it does not need periodic table of operators... and frankly, nobody except Perl gurus can enjoy 100+ operators. In my experience, Perl is NOT a language for occasional users, it does not forgive coder if was neglected it for 6 months: after 6 months, I cannot recognize **my own** Perl code :-)

pmasiar
October 1st, 2007, 02:41 PM
Being able to consent is no excuse for a flaw in the language.

I am not sure what is the flaw? Is flaw that Python is not Ruby?


Unlike in python, methods don't need to be invoked with '()' trailing to show the method is being called without any parameters. However, '()' are used in the case of parameters.

Value of function name without () in Python is reference to that function, how Ruby can pass reference of a function? or it cannot?


Python's syntax for blocks does a poor job of differentiating between a block and a method. That is why it's kludgey.

Class method is just a function defined inside a class. Why I need different syntax for method? Does Ruby have it? What is the difference?


Popularity means little. C++ is a very popular language, but it's pretty much an abomination as a learning language.

I agree that C++ is bad for learning: I propose Python for that. But I disagree about popularity is not important: Just the opposite, popularity IS important, but not the only decision factor. And i like that python is becoming more and more popular.


See my comment about this above - you missed the point. It is not that blocks or lambda's are kludgey, but rather, Python's implementation and syntax of the block is.

And you again claim it and don't provide any answers to my question. Maybe we are talking about different things? Or you just like to argue? :-) You mean Python block, or Ruby block?




only speed that really matters in applications is **speed to the market**.


What are you smoking? It must be really quality stuff.

I am happy for you that you don't have to work for living, but people who do work for living, care more about when code is ready to be sent to the user, and not how syntax look like. Clear syntax is a bonus, not the only goal.




i = 5
j = "Hello"
puts i.to_s + j

While Ruby doesn't randomly let you make use of the + method on an integer and a string, you can instead print the value of i converted to a string on the fly.

.to_s is a method, not an attribute? It certainly looks like one. Really confusing. Ruby looks nearly as object-obsessed as Java (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html). The more I learn about Ruby, the more I appreciate clean design of Python, thank for explaining it for me. :-)

LaRoza
October 1st, 2007, 02:44 PM
.to_s is a method, not an attribute? It certainly looks like one. Really confusing. Ruby looks nearly as object-obsessed as Java (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html). The more I learn about Ruby, the more I appreciate clean design of Python, thank for explaining it for me. :-)

That is why I didn't like Ruby, it is vague in areas, like the optional () for most things, and its OO obsession.

xtacocorex
October 1st, 2007, 03:20 PM
With all this OOP flying around, I guess I should recommend FORTRAN. Not only can it do math better than anything else, that's pretty much all it's good at doing. :)

It's also very easy to read and learn.

LaRoza
October 1st, 2007, 03:22 PM
With all this OOP flying around, I guess I should recommend FORTRAN. Not only can it do math better than anything else, that's pretty much all it's good at doing. :)

It's also very easy to read and learn.

It isn't OO. At least, Fortran 77 isn't, which is what I use.

CptPicard
October 1st, 2007, 03:40 PM
That is why I didn't like Ruby, it is vague in areas, like the optional () for most things, and its OO obsession.

I actually prefer Ruby because it's more consistently OO than Python and the OO structures are cleaner... everything is a method on some object. Which is why you don't even need to enforce the attribute-method call separation that strongly, therefore the option to leave out the (). Even when you want a value out of an object, you use a getter, so everything the object exposes to the outside world is, in OO-speak, a "message" sent to the object, which possibly produces a value. From the outside you don't really need to know much more. If you want to pass parameters, you may wrap then in ()... which is optional though.

I guess the only thing I don't like about Ruby is are the funny scope characters on variables... but I'm sure they serve some purpose as well.

LaRoza
October 1st, 2007, 03:41 PM
I actually prefer Ruby because it's more consistently OO than Python and the OO structures are cleaner...

Perhaps that is a strength, but most of my code is procedural in nature.

xtacocorex
October 1st, 2007, 03:51 PM
It isn't OO. At least, Fortran 77 isn't, which is what I use.
You are correct, which is why I posted it since it's mainly procedural. F90/95 can do OOP-like things, but I don't think your objects can have procedures, I'm not fully sure though. I haven't messed with it much since it's not as intuitive as OOP in C++. F03 is OOP, which will be nice.

mssever
October 1st, 2007, 04:03 PM
Value of function name without () in Python is reference to that function, how Ruby can pass reference of a function? or it cannot?As far as I know, Ruby always passes by reference. If you want the effect of passing by value, you can call the object's dup method explicitly. I must say, however, that I've never had occasion to pass by anything other than reference.

Class method is just a function defined inside a class. Why I need different syntax for method? Does Ruby have it? What is the difference?Ruby only has methods. You can use them as functions if you like, but they're really methods.

.to_s is a method, not an attribute? It certainly looks like one. Really confusing. Ruby looks nearly as object-obsessed as Java (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html). The more I learn about Ruby, the more I appreciate clean design of Python, thank for explaining it for me. :-)

In Ruby, all instance variables are private. So in 45.to_s, to_s can only be a method. It's vary consistent. You could call 45.to_s(), but Ruby doesn't make you type the parentheses when they're unnecessary. The situation is a bit like writing conditionals. You can often omit parentheses and let operator precedence determine the meaning, but sometimes it's clearer to parenthesize. The meaning of something like this should be quite clear without parentheses:
["foo", "bar", "baz", "foo"].sort.uniq

By the way, Ruby is the only language I know of that can get away with making all instance variables private (which is theoretically superior, but a real nuisance in C++ or Java). That's because Ruby can write all the accessor methods you need for you. For example, specifying
attr_accessor :foo, :bar will result in ruby generating code similar to the following:
def foo
@foo
end

def foo=(other)
@foo = other
end

def bar
@bar
end

def bar=(other)
@bar = other
endSo Ruby does what is theoretically best, without adding any inconvenience.

As far as object obsession goes, it is true that in Ruby, everything is an object. If fact, it's even more true than in Java. But if you want to write procedural code in Ruby, Ruby is happy with that, too. This is actually something that I like better about Ruby than Python. Ruby is consistent. In Python, some things are objects, some are not. So you have to remember which are which.

mssever
October 1st, 2007, 04:27 PM
I guess the only thing I don't like about Ruby is are the funny scope characters on variables... but I'm sure they serve some purpose as well.
They save a lot of typing. In Ruby, you rarely have to type self.something, because the scope conventions that Ruby enforces make your intentions plain.

The main things that I don't like about Ruby would be solved by a larger user base. First, the documentation is sometimes sub-par. Second, Ruby's library is a lot smaller than Python's. Overall, though, I think that Ruby is on par with Python, and preference between the two probably has a lot to do with individual preference. Ruby fits me better than Python, because it feels more natural. Others like Python better.

pmasiar
October 1st, 2007, 07:28 PM
I am not sure why you answer questions instead of ButteBlues, maybe you can see into his mind?

As far as I know, Ruby always passes by reference.

This is NOT what I asked. Reference to a functions a variable, which value is function. And I can assign other function to it, and call it, etc. Seems to me that Ruby's syntax does not allow it as simply as Python syntax does.

>Ruby only has methods. You can use them as functions if you like, but they're really methods.

So there is no way to have functions outside a class? So Ruby is as object-obsessed as the lenked above rant about java said? Good to know and avoid Ruby.

> In Ruby, all instance variables are private. So in 45.to_s, to_s can only be a method

but num=45; num.to_s?
How I can know that it is method and not attribute?


> You can often omit parentheses and let operator precedence determine the meaning, but sometimes it's clearer to parenthesize.

I prefer ALWAYS write parens. What if my understanding of order does not match reality? :-)


def foo
@foo
end

def foo=(other)
@foo = other
end


@foo returns value in first case, and stores it in the second? Rather confusing. I miss good old "return @foo". And "foo=(other)" looks rather confusing too. method name is same as attribute name.

I really like Python wisdom "explicit is better than implicit" even more now. :-) You make me appreciate Python more. :-)

> So Ruby does what is theoretically best, without adding any inconvenience.

... but with spreading confusion thickly :-)

> As far as object obsession goes, it is true that in Ruby, everything is an object. If fact, it's even more true than in Java.

Don't scare me like that! Did you read the linked article, "execution in the kingdom of nouns? And you can still pretend it is a good thing?

> But if you want to write procedural code in Ruby, Ruby is happy with that, too. This is actually something that I like better about Ruby than Python. Ruby is consistent.

Your definition of consistent differs from mine.

> In Python, some things are objects, some are not. So you have to remember which are which.

Not sure what you mean. Any examples?

When I asked you to example of function as first-class object, you misinterpreted my question. Does Ruby allow it at all?

BTW this is all nitpicking: Ruby is second best language I would think to use for what I do (web apps) after Python, I would prefer Ruby to Perl, or (shudder) any of Java/C++/C#.

CptPicard
October 1st, 2007, 08:38 PM
I am not sure why you answer questions instead of ButteBlues, maybe you can see into his mind?

Oh yes, Rubyistas are telepathic. Let me try :)

(Ok, I'm not a Ruby authority by any means but have done more in Ruby about as much as I have in Python)



This is NOT what I asked. Reference to a functions a variable, which value is function. And I can assign other function to it, and call it, etc. Seems to me that Ruby's syntax does not allow it as simply as Python syntax does.

Correct, Ruby doesn't do that the way Python does, so that you can just def Proc and then a = Proc => a(x) = Proc(x). Here's a way to extract a method:



class MyClass
def myMethod(i, j)
i + j
end
end

# instanciate a MyClass
m = MyClass.new
# get the symbol representing myMethod inside the MyClass
m fp = m.method( :myMethod )
# call the method through the pointer
fp fp.call(1, 2) # -> 3


Ruby does, however, have the blocks, the closure mechanism which allows you to define on the fly one-off functions, essentially lambdas. Also, a block can be passed to an object, after which you get a procedure object (http://www.ruby-doc.org/docs/UsersGuide/rg/procobjects.html). It's certainly an instance of the "chaperone/wrapper" way of thinking that was criticised in the blog post.. which was very funny btw.. ;) But with a procobject, you get the closure too :)

You can write module-level functions which technically are methods of the module object. This, I think, comes closest to traditional procedure, but I'm not sure if you can use "function pointers"...



but num=45; num.to_s?
How I can know that it is method and not attribute?


Why do you need to? It's just something you yank on the object, and you never have exposed properties.



...method name is same as attribute name.


Because externally all you care of is the method.



Not sure what you mean. Any examples?


The "len" function is my favourite example. :p It's something that should obviously be a method...

pmasiar
October 1st, 2007, 09:15 PM
Oh yes, Rubyistas are telepathic.

that is one more argument to avoid Ruby: then any other Rubyist could read my mind! oh the horrors!


The "len" function is my favourite example. :p It's something that should obviously be a method...

most sequence-like objects (all I tried :-) ) have internal __len__() method, which can be overridden to define your own way to calculate length, using len().

I agree that len() could be a method, but "practicality beats purity".

If this is the biggest gripe you have, Python is more than good enough :-)

mssever
October 1st, 2007, 09:24 PM
So there is no way to have functions outside a class? So Ruby is as object-obsessed as the lenked above rant about java said? Good to know and avoid Ruby.
Ruby isn't obsessed like Java. If you define methods outside of a class, they become methods of Object, the base class for all other classes. In other words, you can use them just like they were regular functions, and you don't need any special syntax.

but num=45; num.to_s?
How I can know that it is method and not attribute?Because all attributes (instance variables in Ruby parlance) are private and can only be accessed via a method. But, since instance variables have names beginning with @, you can write a method with the same name as the variable, if you want. If you end your method name with =, then Ruby allows you to use standard assignment syntax. For example, the statements below are equivalent for a method name ending in =, though the first is the only one in common use:
foo.some_value = 42
foo.some_value=(42)
foo.some_value= 42
I prefer ALWAYS write parens. What if my understanding of order does not match reality? :-)That's a potential gotcha in Ruby if you become too lazy with parentheses. But if a method takes no arguments, what purpose do parentheses serve? There can be no ambiguity in such a situation.

@foo returns value in first case, and stores it in the second? Rather confusing. I miss good old "return @foo". And "foo=(other)" looks rather confusing too. method name is same as attribute name.You can certainly use return if you like. But since everything in Ruby returns a value, you can simply let Ruby automatically return the value of the last expression unless you specifically need to return something different.


> So Ruby does what is theoretically best, without adding any inconvenience.

... but with spreading confusion thickly :-)Python is certainly easier to learn, and it isn't difficult to understand what Python code does even if you don't know the language. But I find Ruby to be more natural than Python now that I know Ruby's extra syntax. Of course, "more natural" is a matter of opinion, and I'm certain you'll disagree. :)


Don't scare me like that! Did you read the linked article, "execution in the kingdom of nouns? And you can still pretend it is a good thing?If I had read that article, I would have phrased that statement differently. (I read it just now.) I meant that conditional statements, loops, and everything are objects in Ruby; but Ruby isn't insane like Java and doesn't force you to do such ridiculous stuff.


> In Python, some things are objects, some are not. So you have to remember which are which.

Not sure what you mean. Any examples?It's been a while sonce I've written any Python, so my memory is a bit rusty. But when I have written Python, it took a bit of effort to remember when to use what. If my memory is correct, you write ["foo","bar","baz"].join(" ") but len("some string").


When I asked you to example of function as first-class object, you misinterpreted my question. Does Ruby allow it at all?Technically, no. In effect, yes. Because Object is the base class for all objects, methods of Object are globally available and callable.


BTW this is all nitpicking:I agree. I just like to see that Ruby gets its due. :) Python would be my second choice language for general purpose programming.

EDIT: Didn't see CptPicard's post...

ButteBlues
October 2nd, 2007, 12:51 AM
I am not sure what is the flaw? Is flaw that Python is not Ruby?

No - it is a flaw to assume that since programming is in nature relying on consent that instance variables should be accessible without getter or setter methods.


I agree that C++ is bad for learning: I propose Python for that. But I disagree about popularity is not important: Just the opposite, popularity IS important, but not the only decision factor. And i like that python is becoming more and more popular.

In that case, I'd still propose Ruby - a language that's more than doubled in users in a year alone (whereas Perl and Python are both decreasing).


You mean Python block, or Ruby block?

I did provide an answer. Python blocks often look just like functions strewn about in the middle of code - whereas Ruby makes a clear difference in syntax between methods and blocks.


I am happy for you that you don't have to work for living, but people who do work for living, care more about when code is ready to be sent to the user, and not how syntax look like. Clear syntax is a bonus, not the only goal.

More and more, daily, companies are starting to care about how beautifully and modularly code is written because they're tired of paying people to re-write things from the ground-up, because the former author did a poor job. Clear syntax is perhaps one of the biggest factors in determining quality of modularity and readability.


.to_s is a method, not an attribute? It certainly looks like one. Really confusing. Ruby looks nearly as object-obsessed as Java (http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html). The more I learn about Ruby, the more I appreciate clean design of Python, thank for explaining it for me. :-)

Everything in Ruby is an object. to_s is a method that acts on objects - just like to_i, to_f, etc. This is not a huge concept by any stretch of the imagination.


That is why I didn't like Ruby, it is vague in areas, like the optional () for most things, and its OO obsession.

The fact that Ruby is an OO language in which all things are objects is one of the reasons why it's such a strong tool. Thanks to this model, it allows you to do things that would require a lot of boiler-plate code in other languages.


I actually prefer Ruby because it's more consistently OO than Python and the OO structures are cleaner... everything is a method on some object. Which is why you don't even need to enforce the attribute-method call separation that strongly, therefore the option to leave out the ().

And in fact, it rarely does. In Ruby, I it is common to see both:


f.title = my_title
f.set_title(my_title)


Perhaps that is a strength, but most of my code is procedural in nature.

Desktop and web applications are inherently favorably paired with OOP models, so that makes OO nature a strength for Ruby.


I am not sure why you answer questions instead of ButteBlues, maybe you can see into his mind?

Because I'm not the only person who knows a thing or two about Ruby?


This is NOT what I asked. Reference to a functions a variable, which value is function. And I can assign other function to it, and call it, etc. Seems to me that Ruby's syntax does not allow it as simply as Python syntax does.

This, to me, sounds like a bad work-around aiming towards getter and setter methods.


So there is no way to have functions outside a class? So Ruby is as object-obsessed as the lenked above rant about java said? Good to know and avoid Ruby.

Wrong.

By default, any methods not put into another class belong to the class 'Object'.


but num=45; num.to_s?
How I can know that it is method and not attribute?

Why should it matter?


@foo returns value in first case, and stores it in the second? Rather confusing. I miss good old "return @foo". And "foo=(other)" looks rather confusing too. method name is same as attribute name.

Here's an example that might make a bit more sense to you:



class Song
attr_accessor :title, :artist

def tell_me
puts "#{@title} by #{@artist}"
end
end

s = Song.new
puts s.title
# => nil
s.title = "A Night in Tunisia"
s.title
# => "A Night in Tunisia"
s.artist = "Dizzy Gillespie"

s.tell_me
# => "A Night in Tunisia by Dizzy Gillespie"


Don't scare me like that! Did you read the linked article, "execution in the kingdom of nouns? And you can still pretend it is a good thing?

Most of it was FUD or inapplicable to Ruby.

slavik
October 2nd, 2007, 01:52 AM
Yes you can do it, but not in casual/random way Perl does it. Python is **strongly** but dynamically typed language. It is different from perl, what is weakly dynamically typed. Perl is willing and eager to transform values from one type to another without warning.

In Python, operator + requires either both numbers (for addition) or both strings (for concatenation). So you can do many things, but all are strongly typed:



h = 'hello'
n = 5
print h + str(n)
print '%s%i' % (h, n)
print h, n # values separated by space


Python is not Perl, Python has operator overloading , so it does not need periodic table of operators... and frankly, nobody except Perl gurus can enjoy 100+ operators. In my experience, Perl is NOT a language for occasional users, it does not forgive coder if was neglected it for 6 months: after 6 months, I cannot recognize **my own** Perl code :-)
Hey, I can read my code from 5 years ago fine ... except I am amazed by the shortcuts I didn't take to make my code half as long. :P

I can agree with you that Perl code can be unreadable. But it's like using a shell, you remember the things you use most often.

YAPE (Yet Another Perl Example):


if ("some string" =~ m/(string)/) {
$matched = $1;
}

or



$matched = $1 if ("some string" =~ /(string)/);


don't forget that there will be code that is always unreadable, no matter the language. It has to do with what the code has to do. If the code does some weird ASCII art based on a single parameter (using lots of memory moving stuff) then I doubt it would be possible for you to read it even if it was written in Python.

if it's a simple one-to-one network communication client then anyone who considers himself half-intermediate with perl will understand what is going on (unless the code writer gets overly ambitious at writing unreadable code, in which case you're out of luck either way).

As for Ruby returning the last evaluated expression, C has been doing the same to a similar if not exact effect, that's why you see lots of:


#define MAX(A,B) ((A<B) ? B : A)


Bjarne Stroustroup didn't like macro hackery of this type, that's why there is an inline keyword.

pmasiar
October 2nd, 2007, 01:06 PM
don't forget that there will be code that is always unreadable, no matter the language.

You gave up before fight started. I was always trying to make my code readable, even in Perl. :-)

LaRoza
October 2nd, 2007, 01:23 PM
The fact that Ruby is an OO language in which all things are objects is one of the reasons why it's such a strong tool. Thanks to this model, it allows you to do things that would require a lot of boiler-plate code in other languages.


OO is does not indicate a language is useful, or better than any other.

Ruby has not been able to do anything I couldn't do in another language, with less effort. Often, I am using a language, or feature I do not know (RTFM :D, you know), and just yesterday I wrote a GUI program, using a library I never used, from a small handbook to do a specific task. I wrote it in Python, because I knew the libraries are there, even if I do not know of them, and it is extremely easy to learn on the fly. I have not been able to do that with Ruby, although I have tried. Maybe the language is too new to have the available resources. I see no advantage in using it for anything when you have Python or Perl.

I am not knocking it, and have learned it (a while ago, just the basics) and found it to be a new language, with nothing new to offer.

pmasiar
October 2nd, 2007, 01:32 PM
No - it is a flaw to assume that since programming is in nature relying on consent that instance variables should be accessible without getter or setter methods.

Well, I don't share your religion, and I don't drink that kool-aid. "Practicality beats purity" for me.


In that case, I'd still propose Ruby - a language that's more than doubled in users in a year alone (whereas Perl and Python are both decreasing).


You are very good in pulling stats out of your ... thin air :-) Any links?


I did provide an answer. Python blocks often look just like functions strewn about in the middle of code - whereas Ruby makes a clear difference in syntax between methods and blocks.

no you did not. "block" in Python is anything with indent. "if" block, "for" block, "def" block etc. Of course they are scattered in code :-)


More and more, daily, companies are starting to care about how beautifully and modularly code is written because they're tired of paying people to re-write things from the ground-up, because the former author did a poor job. Clear syntax is perhaps one of the biggest factors in determining quality of modularity and readability.

This is theory.

Let me tell you one secret: in theory, there is no difference between theory and practice. In practice, there is.

You just proved that you don't have real-world experience. In real world, people do not care much about beautiful and modular code: they care about deadlines more.

So I partially agree, and this is the reason why Python will win: because it is practical before being beautiful :-)


Ruby is an OO language ... it allows you to do things that would require a lot of boiler-plate code in other languages.

I agree that Ruby is win over Java or C++. But Python? Which Python code is boilerplate replacement for Ruby goodness?


Desktop and web applications are inherently favorably paired with OOP models, so that makes OO nature a strength for Ruby.

Or exactly as well, Python. You try to pretend that Python is some statically typed monster like java, while you conceded that function cannot be as easily passed around as in Python.




Wrong. You just observe world with ruby-colored glasses, and anything which Ruby cannot do is useless to you.

You can pass function anywhere - function is first-class object, unlike Ruby, I was said.

[quote]By default, any methods not put into another class belong to the class 'Object'.

You just proved to me that verbs cannot exist alone in Ruby, exactly what was rant about. So Ruby is closer to Java than Python in this aspect. I see now, this is why so many people formerly hyping Java now moved to Ruby.

No thanks. OOP is good, but it is not the only way to describe things, not the only religion possible. I am agnostic :-) I **like** that Python is multi-paradigm language.

CptPicard
October 2nd, 2007, 01:56 PM
You can pass function anywhere - function is first-class object, unlike Ruby, I was said.
...
You just proved to me that verbs cannot exist alone in Ruby, exactly what was rant about.

I really don't understand why this is such a killer feature. I can't remember the last time I was actually passing around first-class functions in a non-functional programming language

Ruby does allow non-OOP style programming by attaching non-class methods to Object as has been said, which from a programmer perspective is not even a difference you'll really notice unless you have to think of it.

You do have the procedure objects for when you do need a first-class function.

I am somewhat sceptical of the benefit of going all wild with function pointers in a dynamically typed language, because it just allows renaming things apart from what we've got in Ruby, and functions still are tied to their nouns because if you do give your verb the wrong kind of noun, bad things will surely follow. It's even worse when you can just freely hack an object by assigning whatever methods to it... your noun breaks even worse if you give it the wrong kind of verb. Inheritance is for class extension, not hacks like that... programmers may be consenting adults, but this takes a lot of consent :)

ButteBlues
October 2nd, 2007, 02:22 PM
OO is does not indicate a language is useful, or better than any other.

But having a language designed from the ground-up to be OO when writing applications that tend towards the OOP paradigm does.


Ruby has not been able to do anything I couldn't do in another language, with less effort. Often, I am using a language, or feature I do not know (RTFM :D, you know), and just yesterday I wrote a GUI program, using a library I never used, from a small handbook to do a specific task. I wrote it in Python, because I knew the libraries are there, even if I do not know of them, and it is extremely easy to learn on the fly. I have not been able to do that with Ruby, although I have tried. Maybe the language is too new to have the available resources. I see no advantage in using it for anything when you have Python or Perl.

Then quite simply, you aren't using Ruby for what it is - but rather are trying to apply Python/Perl kinds of thinking to a solution that could be arrived at simpler.


I am not knocking it, and have learned it (a while ago, just the basics) and found it to be a new language, with nothing new to offer.

You didn't look too much then. ;)


Well, I don't share your religion, and I don't drink that kool-aid. "Practicality beats purity" for me.

Practicality is having a language that is properly designed and doesn't allow you to randomly assign methods and instance variables without getters or setters.


You are very good in pulling stats out of your ... thin air :-) Any links?

It was a study published on Digg and Slashdot about 3-4 months back. Google for it.


no you did not. "block" in Python is anything with indent. "if" block, "for" block, "def" block etc. Of course they are scattered in code :-)

You're confusing the syntactical block with the indented one. Blocks (the real kind - not the name for indented code) in Python have terrible syntax.


This is theory.

Let me tell you one secret: in theory, there is no difference between theory and practice. In practice, there is.

You just proved that you don't have real-world experience. In real world, people do not care much about beautiful and modular code: they care about deadlines more.

So I partially agree, and this is the reason why Python will win: because it is practical before being beautiful :-)

You my friend are speaking ********. When you're actually working for corporations doing consulting and coding, feel free to talk. But the "experience" you're citing shows a complete lack of actual experience in the field.


I agree that Ruby is win over Java or C++. But Python? Which Python code is boilerplate replacement for Ruby goodness?

Python's whole implementation of objects for a start.


Or exactly as well, Python. You try to pretend that Python is some statically typed monster like java, while you conceded that function cannot be as easily passed around as in Python.

You're missing the point - that kind of access isn't necessary in Ruby because Ruby implements the same ability properly. Python's way of dong it is a bad work-around for a poor design in that area of the language.


Wrong. You just observe world with ruby-colored glasses, and anything which Ruby cannot do is useless to you.

And of course you're not just looking out at the world through Python's glasses. :popcorn:

Honestly, the most annoying thing about you Python purists is that you set there and pretend like every Ruby user is a fanboy and that no Python fanboys exist at all. I've got news for you: a vast majority of the Python purists are just as big a fanboys, if not moreso, than the Ruby fanboys. Just because Python came first doesn't exempt you lot from reality.


You can pass function anywhere - function is first-class object, unlike Ruby, I was said.

And again, this "functionality" is unnecessary in Ruby - it's handled better there.


You just proved to me that verbs cannot exist alone in Ruby, exactly what was rant about. So Ruby is closer to Java than Python in this aspect. I see now, this is why so many people formerly hyping Java now moved to Ruby.

No thanks. OOP is good, but it is not the only way to describe things, not the only religion possible. I am agnostic :-) I **like** that Python is multi-paradigm language.

CptPicard and I have addressed this twice already - there's no excuse for ignorance in this matter at this point of the thread.

hibernaculus
October 2nd, 2007, 02:49 PM
In my opinion, Ruby is the easiest interpreting languag... But Python has more libraries, bytecode compiler etc.
I think in future (maybe when will be Ruby 2.0 with buit-in YARV) everything will change... :)

ButteBlues
October 2nd, 2007, 02:52 PM
In my opinion, Ruby is the easiest interpreting languag... But Python has more libraries, bytecode compiler etc.
I think in future (maybe when will be Ruby 2.0 with buit-in YARV) everything will change... :)
I do agree that at the moment Ruby lacks in a few areas - but as you said, Ruby 2.0, so long as it's not rushed out the door, will be pretty sweet.

Same for Rails 2.0 which is almost out already.

pmasiar
October 2nd, 2007, 04:09 PM
It was a study published on Digg and Slashdot about 3-4 months back. Google for it.

This was **your** claim. You should be the one providing the evidence. I can google for contra-evidence when I will have time :-)


You're confusing the syntactical block with the indented one. Blocks (the real kind - not the name for indented code) in Python have terrible syntax.

What is the "real" block then? Any examples?

You really like to say strong words without any evidence.


When you're actually working for corporations doing consulting and coding, feel free to talk. But the "experience" you're citing shows a complete lack of actual experience in the field.

I code for living for 25 years. I laugh at your face.


You're missing the point - that kind of access isn't necessary in Ruby because Ruby implements the same ability properly.

Python's way of dong it is a bad work-around for a poor design in that area of the language.


OK, your position is, whatever Ruby does, is flawless by design, and above critique. Nothing more to discuss about it. Just get me the links to statistics you invented above.

LaRoza
October 2nd, 2007, 05:16 PM
But having a language designed from the ground-up to be OO when writing applications that tend towards the OOP paradigm does.

Then quite simply, you aren't using Ruby for what it is - but rather are trying to apply Python/Perl kinds of thinking to a solution that could be arrived at simpler.

You didn't look too much then. ;)



0. Python?

1. Then what is it good for, if not for what I use Python et al. Is there some hidden aspect of programming that Ruby excels in? I am not saying it isn't a good language, as I do not know it well enough nor do I have enough experience, but you haven't told me what I should be using it for, just that it is "better" than Python, and others.

2. You're right, but then again, I didn't dive into Python (pardon the pun), either, I worked with it and it became useful as soon as I started learning it. Ruby was just a bunch of different rules and syntax, which was easily learned, but I could find no reason to use it in place of Python, or even Perl.

CptPicard
October 2nd, 2007, 05:42 PM
You're confusing the syntactical block with the indented one. Blocks (the real kind - not the name for indented code) in Python have terrible syntax.

You guys are almost creating intentional semantic confusion here so you can beat each other over the head with then ;)

You say Python's blocks have terrible syntax? Meaning you're opposed to the semantic whitespace thing? Or that Python's lambda is ugly?

The issue here is of course that Ruby's block is a bit more than the typical syntactical block in other languages, like C, that, yes, you tend to indent for readability and preferably delimit with something visual like { } ;) It's a bit like comparing apples and oranges...

Ruby's block is a (potentially parametrized) closure you pass to some function for yielding values. It's more powerful than the usual block that is essentially a static piece of scope in code.

An implementation question I've never thought of btw... are all Ruby's { } -delimited code regions actually implemented (unparametrized) lambda-style blocks?


You're missing the point - that kind of access isn't necessary in Ruby because Ruby implements the same ability properly. Python's way of dong it is a bad work-around for a poor design in that area of the language.

Don't understand this part of your argument. What exactly does Python's function pointer passing ability work around?

It's just a feature that would be a bit out of place in a strict-OO language, but I would certainly not call it a workaround hack...

Wybiral
October 2nd, 2007, 06:04 PM
I don't know if Ruby can/cannot do this, and I don't care to join this war, but I can help answer this question:


I really don't understand why this is such a killer feature. I can't remember the last time I was actually passing around first-class functions in a non-functional programming language

One really good example that comes to mind is an event-based system. Take, for instance, a GUI API you're writing. How do you assign user functions to a part of your code if the user cannot pass a reference to the function? They add a button to the GUI and they need one of their functions to be executed when the button is clicked. And not just for a GUI API, any system that requires callbacks. A complex dispatching system certainly benefits from callbacks to avoid huge conditional situations.

Function pointers also make code reuse incredibly simple. For instance, that ancient "qsort" function from C. Since you can't generically compare everything, you can write your own function to do the comparing for you. This allows you to not write a new sort function for every single type of object in your program, you just need one sort algorithm and you can pass the compare algorithm to it.

As for a couple of other comments I noticed...


Practicality is having a language that is properly designed and doesn't allow you to randomly assign methods and instance variables without getters or setters.

:roll: If practicality is object obsession, OK. But not all of us want to go down that route. Practicality in the real world is: clean, logical, and efficient. All of which enforced getter/setter restriction is not. If you do not need to abstract away a member for usage safety reasons, why should you? Enjoy your function call overhead. I don't call that practical AT ALL.


You're confusing the syntactical block with the indented one. Blocks (the real kind - not the name for indented code) in Python have terrible syntax.

You are confusing Ruby with everything else. How do Python (http://www.ubuntu.com/community/developerzone/bounties#head-41c34de429ab5a0dd9541ab19d884a40a2e89f9e) "blocks" have terrible syntax? Python does not have "blocks", no one knows what you're talking about. Ruby has blocks, the rest of the world has lambdas (http://docs.python.org/ref/lambdas.html) and function pointers... And lambdas (http://en.wikipedia.org/wiki/Lisp_programming_language#Lambda_expressions) have been around for a long time (http://en.wikipedia.org/wiki/Lambda_calculus). Complain about code not being pretty all you want, not all of us are fashion police (http://www.suncityrecords.com/Pages/Bands/Fashion%20Police/Fashion%20Police%20LowRes.jpg). If they do the same thing with the same amount of readability and code size, why argue about them? You sound like a fanatic (http://www.etymonline.com/working/fanatic-small.jpg) to me.

ButteBlues
October 2nd, 2007, 06:34 PM
:roll: If practicality is object obsession, OK. But not all of us want to go down that route. Practicality in the real world is: clean, logical, and efficient. All of which enforced getter/setter restriction is not. If you do not need to abstract away a member for usage safety reasons, why should you? Enjoy your function call overhead. I don't call that practical AT ALL.

How is requiring getters/setters not logical. The point of instance variables is that they're supposed to be private to the instance - not something you can just modify without explicitly creating the methods needed to do so.


As for lambdas versus blocks: I dislike Python's syntax in regards to lambdas. Lisp's is much less esoteric, in my opinion. While I did get a bit lazy in referring to Python's lambda's as "blocks", the usage of lambdas in Python and blocks in Ruby is much the same - though of course, there is a difference (hence why Ruby has lambdas as well).

As for all the OO-hate going around and complaining that OO is somehow not beautiful or readable... well that's some wonderful hypothesizing, but the real world would like a word.

slavik
October 2nd, 2007, 06:56 PM
You don't need an OO language to have OO.

Node *n = new_node(); is as good as Node *n = new Node();

and

change_node(n); is the same as n->change();

like I keep saying, X is OO, so is GTK, but they are written in C.

The only thing Stroustroup did to add functionality to C's struct was to allow functions to go inside the struct. He also disliked members being public by default (to keep backward compatibility with C's struct) so he changed struct to class and made all members private by default.

Wybiral
October 2nd, 2007, 07:03 PM
How is requiring getters/setters not logical. The point of instance variables is that they're supposed to be private to the instance - not something you can just modify without explicitly creating the methods needed to do so.

Apparently I didn't get that memo. Where in your "big book of OOP" does it say that members MUST be private? Some members... Sure, if they can cause negative effects from improper use, then make them private and encapsulate. But some stuff is completely logical to make public. You sound like an OOP fundamentalist, taking encapsulation too literally. Encapsulate what you need to WHEN you need to, but littering your code with getters/setters "just because" is a great way to cause bloat and reduce efficiency.


As for lambdas versus blocks: I dislike Python's syntax in regards to lambdas. Lisp's is much less esoteric, in my opinion. While I did get a bit lazy in referring to Python's lambda's as "blocks", the usage of lambdas in Python and blocks in Ruby is much the same - though of course, there is a difference (hence why Ruby has lambdas as well).

OK. That's understandable. But you have to realize that this is just as much of a preference as saying "OK, so blue is a color after all, but pink still looks better".


As for all the OO-hate going around and complaining that OO is somehow not beautiful or readable... well that's some wonderful hypothesizing, but the real world would like a word.

I like OOP and when I use C++ or Python I try to take full advantage of their OO features. But, when I have something like this...



class
{
object x, y, z;
};


And it DOESN'T damage anything to use them directly, I see no reason to overrun my classes with crap like this:



class
{
object x, y, z;
object getX();
object getY();
object getZ();
void setX();
void setY();
void setZ();
};


Classic example of unnecessary code bloat (http://en.wikipedia.org/wiki/Code_bloat). Why in the world is "o.setX(something)" any better then "o.x = something"? It isn't, unless it damages part of your code, in which case I understand the need to encapsulate. But you're suggesting that we should just accept the extra code and waste our time writing an unneeded interface. That's not practical.

pmasiar
October 2nd, 2007, 09:26 PM
How is requiring getters/setters not logical. The point of instance variables is that they're supposed to be private to the instance - not something you can just modify without explicitly creating the methods needed to do so.

Not in my religion. If something is a string, and is supposed to be a string, why bother? It smells like Cargo cult programming (http://en.wikipedia.org/wiki/Cargo_cult_programming) to me: it is supposed to work :-)

Re your "thin air" statistics: Google trends (http://www.google.com/trends?q=ruby+programming%2C+python+programming&ctab=0&geo=all&date=all&sort=0) says, that "python programming" beats "ruby programming" all the time. I googled it, and I won! :-)


I dislike Python's syntax in regards to lambdas. ... While I did get a bit lazy in referring to Python's lambda's as "blocks",

**Finally** you answered! Did you enjoyed the discussion about "Python blocks"?

Well, I LIKE python syntax and DISLIKE Ruby, but I don't pretend that it is a substantiated argument, unlike you. And **you** want to lecture **me** about fanboyism? LOL!


As for all the OO-hate going around and complaining that OO is somehow not beautiful or readable... well that's some wonderful hypothesizing, but the real world would like a word.

You **still** did not answered what real-world experience you have, but from your insisting on academic values like "beauty", I guess not much. I don't hate OOP, I just have real priorities - like finishing program for my boss. He does not care about OOP a bit. Nada, zilch. Shocking for you? Can you handle that?

ButteBlues
October 2nd, 2007, 10:07 PM
Not in my religion. If something is a string, and is supposed to be a string, why bother? It smells like Cargo cult programming (http://en.wikipedia.org/wiki/Cargo_cult_programming) to me: it is supposed to work :-)

Re your "thin air" statistics: Google trends (http://www.google.com/trends?q=ruby+programming%2C+python+programming&ctab=0&geo=all&date=all&sort=0) says, that "python programming" beats "ruby programming" all the time. I googled it, and I won! :-)



**Finally** you answered! Did you enjoyed the discussion about "Python blocks"?

Well, I LIKE python syntax and DISLIKE Ruby, but I don't pretend that it is a substantiated argument, unlike you. And **you** want to lecture **me** about fanboyism? LOL!



You **still** did not answered what real-world experience you have, but from your insisting on academic values like "beauty", I guess not much. I don't hate OOP, I just have real priorities - like finishing program for my boss. He does not care about OOP a bit. Nada, zilch. Shocking for you? Can you handle that?
The irony inherent in your bandying about and calling everyone who happens to favor another language over Python "fanboys" is so ridiculously funny.

santiagoward2000
October 2nd, 2007, 10:10 PM
Spanish is an easy language. LOL, just kidding, I have no idea about programing.

Wybiral
October 2nd, 2007, 10:24 PM
The irony inherent in your bandying about and calling everyone who happens to favor another language over Python "fanboys" is so ridiculously funny.

The reason you sound like a "fanboy" is because you've been arguing nothing but opinion and asserting it as some kind of fact and labeling everyone as hating OOP or not knowing proper OOP (asserting that objects must use getter/setter) just because they don't agree with the Ruby way of accomplishing it.

pmasiar
October 2nd, 2007, 10:30 PM
The irony inherent in your bandying about and calling everyone who happens to favor another language over Python "fanboys" is so ridiculously funny.

Yet is was **you** who first used term "fanboy" in this thread - and you **still** did not supported your claims with any links. Hard to find them I guess?

ButteBlues
October 2nd, 2007, 10:35 PM
Yet is was **you** who first used term "fanboy" in this thread - and you **still** did not supported your claims with any links. Hard to find them I guess?
Considering they were posted on Slashdot 4+ months ago, yes it is hard to track them down.

ButteBlues
October 2nd, 2007, 10:37 PM
The reason you sound like a "fanboy" is because you've been arguing nothing but opinion and asserting it as some kind of fact and labeling everyone as hating OOP or not knowing proper OOP (asserting that objects must use getter/setter) just because they don't agree with the Ruby way of accomplishing it.
Ruby is not the only language to require proper setters and getters, nor is it the only language to employ a strict OO model.

And for good reason too.

CptPicard
October 2nd, 2007, 10:40 PM
...or not knowing proper OOP (asserting that objects must use getter/setter) just because they don't agree with the Ruby way of accomplishing it.

You should note though that Ruby allows for an extremely transparent and lightweight way to generate getters and setters by providing a compact way to declare accessors and mutators for properties. You don't actually get the kind of "crap" littering your code you seem to be afraid of. And of course I would suspect any reasonable implementation optimizes those calls away anyway -- there is no actual overhead.

Essentially, it's almost completely equivalent to declaring things "public" in a class, and assuming it's private otherwise... just like C++ ;) The big additional plus is that rewriting the getter/setter into something more substantial is a trivial refactoring, it doesn't even break any outside code.

slavik
October 2nd, 2007, 11:39 PM
You should note though that Ruby allows for an extremely transparent and lightweight way to generate getters and setters by providing a compact way to declare accessors and mutators for properties. You don't actually get the kind of "crap" littering your code you seem to be afraid of. And of course I would suspect any reasonable implementation optimizes those calls away anyway -- there is no actual overhead.

Essentially, it's almost completely equivalent to declaring things "public" in a class, and assuming it's private otherwise... just like C++ ;) The big additional plus is that rewriting the getter/setter into something more substantial is a trivial refactoring, it doesn't even break any outside code.
private by default is only for C++ class, C++ struct has the opposite (original) idea.

as to the OP, I hate to see how this thread went (unless you enjoy this discussion). but as far as languages. come up with a problem and solve it ANY language (put a bunch of them in a hat on pieces of paper and pull one out).

pmasiar
October 3rd, 2007, 01:26 PM
Considering they were posted on Slashdot 4+ months ago, yes it is hard to track them down.

yes, I admit I don't waste time slashdot - I waste it on ubuntu forums :-)

And you **still** did not linked the propaganda^W statistics you mentioned. You are funny guy. Does it exist? All I found was that Python is more popular, consistent with my religion :-)

LaRoza
October 3rd, 2007, 01:35 PM
And you **still** did not linked the propaganda^W statistics you mentioned. You are funny guy. Does it exist? All I found was that Python is more popular, consistent with my religion :-)

Python isn't more popular, look under the Languages section, and look at Japanese. Maybe that is the the basis for the previous unsupported statements?

I reading this thread, the argument for Ruby seems to be:

* It is a good OO language (true, I see no problem with that)
* It is better than Python (with no facts or reasoning other than the poster knows Ruby better)

To those who know Ruby, tell the Python users when they should use Ruby in place of Python, and what advantage it would give them. I find it enjoyable to learn new languages, I just started Lisp (Common Lisp), and am working on Assembly, but I still use PHP and Python for my programming tasks even though I do know more. I also learned Ruby (to a degree). I recommend learning Ruby, but why should I use it?

cmat
October 3rd, 2007, 02:03 PM
Ruby is really good for high schoolers getting ready for college computer sciences. It would have been better than VB and Turing. However I use Python right now, for everything programming. I tried out Ruby, it was nice but I really didn't find a benefit to move from Python.

ButteBlues
October 3rd, 2007, 02:06 PM
Python isn't more popular, look under the Languages section, and look at Japanese. Maybe that is the the basis for the previous unsupported statements?

No. There was some study done (and if I could find the damn article) that showed that the number of Python, Perl, and PHP programmers were on the decline, and that Ruby had doubled in the past year. I'm still looking for it.


To those who know Ruby, tell the Python users when they should use Ruby in place of Python, and what advantage it would give them. I find it enjoyable to learn new languages, I just started Lisp (Common Lisp), and am working on Assembly, but I still use PHP and Python for my programming tasks even though I do know more. I also learned Ruby (to a degree). I recommend learning Ruby, but why should I use it?

The same places you currently use PHP and Python. Ruby's true support for OOP (PHP's implementation is a joke, and Python's has some flaws) makes it a more efficient tool for the task for most people.

Wybiral
October 3rd, 2007, 02:13 PM
Ruby's true support for OOP (PHP's implementation is a joke, and Python's has some flaws)

Out of curiosity, what are Python's OOP flaws? The fact that they aren't enforced? I think Python has a great OOP implementation. It's far from object obsessive, but definitely enough to express things easily and efficiently.

For instance, if you want to handle everything with getters/setters, you can... Python doesn't enforce it either way. Python assumes you know how to program and leaves those types of design choices up to you.

ButteBlues
October 3rd, 2007, 02:26 PM
Out of curiosity, what are Python's OOP flaws? The fact that they aren't enforced? I think Python has a great OOP implementation. It's far from object obsessive, but definitely enough to express things easily and efficiently.

For instance, if you want to handle everything with getters/setters, you can... Python doesn't enforce it either way. Python assumes you know how to program and leaves those types of design choices up to you.

Pretty much every question you could have is spoken of and debated here: http://c2.com/cgi/wiki?PythonVsRuby

Wybiral
October 3rd, 2007, 02:51 PM
Pretty much every question you could have is spoken of and debated here: http://c2.com/cgi/wiki?PythonVsRuby

Nope. I just read it and didn't see any "flaws" in Pythons OOP implementation. What exactly are you referring to?

pmasiar
October 3rd, 2007, 04:07 PM
Python isn't more popular, look under the Languages section, and look at Japanese. Maybe that is the the basis for the previous unsupported statements?

maybe Ruby IS more popular with Japanese hackers. Of course, it was started by a japanese hacker. Why it would be relevant to most people, who are NOT japanese? For me, factoid that main development mail list is in Japanese (and not in english) is MAJOR DRAWBACK and reason to avoid Ruby, a language where I cannot follow hot development trends.

My google trends links above was the only "facts" we had in this discussion, and it proved MY point: that Python is more popular. I am not claiming that is it true or even relevant, but that was the only "FACTS" (as compared to pure OPINIONS) we got so far.

@ButteBlues:

I have no problem if you want to spread Ruby propaganda, just provide some links to facts. Pure opinion is pure BS. I have plenty of my own opinions, want some? :-)

Edit: Looks like you just proved Benford's law of controversy. Your last link to c2.com was FINALLY some real info.

pmasiar
October 4th, 2007, 10:00 PM
Sadly, ButteBlues is still looking for the mythical links proving Ruby has bigger user community. I doubt they existed.

Well, I read c2 wiki page s/he suggested, and one of the first outside links on the very beginning page is answer by Alex Martelli (http://groups.google.com/group/comp.lang.python/msg/28422d707512283), famous Python hacker. He said it well, nothing what mere mortal like me can add. Ruby is more fun to hack, but some fun features make it unsuitable for industry-grade coding. Obviously, ButteBlues must be smarter than that. :-)

Many people at that page (it is rather old - c2 members are expert hackers on bleeding edge) complain that they use Ruby because Python does not have Rails. Well, it was then, now we have Django and Turbogears, both are rumored to scale better than Rails.

BTW, Python now has blocks (http://www.python.org/dev/peps/pep-0343/) (the "with" statement) so ButteBlues was confused, misinformed, or misinforming.

We will see if this is the end of the discussion. I learned to appreciate Python even more, so it was not complete waste of time. :-)

Zootropo
October 4th, 2007, 10:36 PM
I'm currently running a poll in my blog asking which will be the most popular language five years from now. Java is winning with 128 votes. Python is 5th and Ruby 8th: ¿Lenguaje de programación más popular? (http://mundogeek.net/archivos/2007/09/26/%c2%bflenguaje-de-programacion-mas-popular/)

The TIOBE ranking data may be a little more representative, anyway :P

http://www.tiobe.com/index.htm?tiobe_index

Zootropo
October 4th, 2007, 10:37 PM
BTW, I'd recommend Python

slavik
October 5th, 2007, 12:13 AM
on the subject of python vs. ruby ... I tend to use perl for large scripting and text processing and I have found that it does everything I want it to.

ButteBlues
October 5th, 2007, 04:43 AM
Sadly, ButteBlues is still looking for the mythical links proving Ruby has bigger user community. I doubt they existed.

First and foremost, you are entirely misrepresenting what I've said. I said the article cited decline in the number of PHP, Perl, and Python programmers, while a vast growth in the number of Ruby programmers.

Secondly, I've spent all of today getting foot surgery and then installing openSUSE 10.3. Believe it or not, I don't have every moment of every day to trawl through Slashdot and Google records to find an article for a language holy war on an Internet forum.


Well, I read c2 wiki page s/he suggested, and one of the first outside links on the very beginning page is answer by Alex Martelli (http://groups.google.com/group/comp.lang.python/msg/28422d707512283), famous Python hacker. He said it well, nothing what mere mortal like me can add. Ruby is more fun to hack, but some fun features make it unsuitable for industry-grade coding. Obviously, ButteBlues must be smarter than that. :-)

You read one man's arguments on the matter. His opinions do not constitute fact, nor does your attempt to troll me (and use it as a backhanded strawman at that).


Many people at that page (it is rather old - c2 members are expert hackers on bleeding edge) complain that they use Ruby because Python does not have Rails. Well, it was then, now we have Django and Turbogears, both are rumored to scale better than Rails.

Django and Turbogears are both fairly awful. Since you seem to see popularity as a measure of quality, we can similarly compare the very little "hype" surrounding either of them - as compared to the endless "hype" about Rails.

And Rails 2.0 is due to launch in a few months, with some very nice changes that should help as far as scaling goes.


BTW, Python now has blocks (http://www.python.org/dev/peps/pep-0343/) (the "with" statement) so ButteBlues was confused, misinformed, or misinforming.

If you'd read your own link, you'd know what they're talking about as far as 'with' goes, it does not offer the same functionality as Ruby's blocks (it, from what I've read, is pretty specific towards handling resource allocation/deallocation).

Beyond that, the closest thing to Ruby's block is the Python lambda (which is severely crippled to begin with).


We will see if this is the end of the discussion. I learned to appreciate Python even more, so it was not complete waste of time. :-)

I'm glad you feel even more comfortable with the fact that you have continued to try and talk down Ruby for not being a clone of Python (since of course, Python is the holy grail of all programming languages), but it hasn't proven anything. Arguing argumentum ad infinitum doesn't prove anything either.

mssever
October 5th, 2007, 06:42 AM
>When I asked you to example of function as first-class object, you misinterpreted my question. Does Ruby allow it at all?
Technically, no. In effect, yes. Because Object is the base class for all objects, methods of Object are globally available and callable.

I gave this reply without knowing what I was talking about.:oops:

In fact, a consequence of the fact that everything in Ruby is an object is that all methods are first-class functions. After all if you can create, pass, and return strings, numbers, etc., then you can do the same for classes and methods. Everything's an object. And Kernel#method returns the named method as an object. For example, here's a paste from irb, Ruby's interactive shell:
>> def something
>> 42
>> end
=> nil
>> method :something
=> #<Method: Object#something>
>> method(:something).call
=> 42I just wanted to correct my previous misstatement.

Hairy_Palms
October 5th, 2007, 12:01 PM
id recommend REALBasic, its not OSS but the standard Linux version is free http://www.realsoftware.com/download/ and they support ubuntu.

pmasiar
October 5th, 2007, 02:02 PM
First and foremost, you are entirely misrepresenting what I've said. I said the article cited decline in the number of PHP, Perl, and Python programmers, while a vast growth in the number of Ruby programmers.

It is YOU who misrepresent what YOU said. I re-read whole thread, wasted whole hour, again. You said:


In that case, I'd still propose Ruby - a language that's more than doubled in users in a year alone (whereas Perl and Python are both decreasing)..

but never provided any link, beyond "it was mentioned couple months ago on slashdot".

You try to mix Perl, which users are decreasing, with Python, who picks those unhappy Perl users, and gets new users too.

My gut feeling is (and I don't have link :-) ), that **beyond web apps area** (where Rails have the most hype), Python is fastest growing scripting language. Python even has separate conference SciPy: Python in science. Is there a "Ruby in science" conference? Every time I see Ruby mentioned it is with Rails, but is much of Ruby beyond Rails? Most of Python usage is beyond web apps.


Secondly, I've spent all of today getting foot surgery and then installing openSUSE 10.3. Believe it or not, I don't have every moment of every day to trawl through Slashdot and Google records to find an article for a language holy war on an Internet forum.

yet you expect ME to do that to support your own claims? LOL. I googled trends, and Python won. Good enough for me.


You read one man's arguments on the matter. His opinions do not constitute fact,

Alex is established Python guru, with books published, and wiki entry. I take his opinion over anonymous forum ... poster like you any time of day. So far I have no reason to trust your opinion, sorry. AFAIK, you might be just any random Ruby fanboy kid. Alex is **expert**, I was on his lecture at PyCon and he is **incredibly** smart and sharp. **Way** beyond mere mortals, if you ask me. Why won't you try to substantiate your claims by links to say blog post of commonly known experts?


nor does your attempt to troll me

You tried to bluff, I called you on it: it is supposed to be trolling? Linus has good rule: put up or shut up. Or Ruby fanboys are not required to substantiate their claims? Please note when I claim something, I (most times) try to provide a link. You are free to call me on it if I don't.


Django and Turbogears are both fairly awful.

ah, these are so called "facts" you prefer so strongly? Let me uninstall TG, now I know from "expert" for sure TG is crap. :evil:


Since you seem to see popularity as a measure of quality, we can similarly compare the very little "hype" surrounding either of them - as compared to the endless "hype" about Rails.

Popularity != hype. Or do you claim otherwise? Dj and TG don't need hype, they are solution used (and loved) in Python community, and they are good. Of course they are not perfect - only projects starting with R can be perfect, right? ;-)


If you'd read your own link, you'd know what they're talking about as far as 'with' goes, it does not offer the same functionality as Ruby's blocks

Of course. It provides 90% of it, with cleaner syntax. If YOU read links from article you provided, you would find page http://c2.com/cgi/wiki?BlocksInPython - it IMHO explains how to replicate the same functionality. What is missing? Or you think the page is wrong?


Beyond that, the closest thing to Ruby's block is the Python lambda (which is severely crippled to begin with).

Again, you claim your "facts". How it is crippled? Maybe you have a case of http://c2.com/cgi/wiki?BlubParadox ?


I'm glad you feel even more comfortable with the fact that you have continued to try and talk down Ruby for not being a clone of Python (since of course, Python is the holy grail of all programming languages), but it hasn't proven anything. Arguing argumentum ad infinitum doesn't prove anything either.

Yes, I AM glad I learned more about why Python (in opinions of experts I trust) is better than Ruby. I also learned some more bits about Ruby, and as I said many times and repeated in this thread, Ruby would be my second choice language.

Arguing WITH LINKS and explaining your positions helps people understand issues. Of course, being "little lazy", like you was when talking about "Python blocks" does not help nor understanding of issues not building calm discussion of FACTS.

But of course you are free to have your strong opinions, and don't bother with substantiating opinions with facts, you can even pretend that I said "Python is the holy grail" (which I never did - another of YOUR strawmen), if it will make your foot surgery recovery faster.

Have a nice day.

pmasiar
October 5th, 2007, 02:19 PM
everything in Ruby is an object is that all methods are first-class functions.


>> def something
>> 42
>> end
=> nil
>> method :something
=> #<Method: Object#something>
>> method(:something).call
=> 42

For completeness, I added same thing in Python. Please note that function name without () returns reference to a function, you can assign it to a different name, and call it as if it was "native", no trickery.

I know it was not your claim, but I cannot see the tasty "syntax sugar" what some Ruby proponents claim :-) all I see is quite a dose of "syntax vinegar" :-)



>>> def something():
return 42

>>> something
<function something at 0x00BA87F0>
>>> s = something
>>> s()
42


here, Ruby inherited from Perl "optional ()" in function call, and as the result Ruby cannot create reference to a function as simple as Python can. So, for the price of having to type () when parameter list is empty, Python can pass function reference much simpler than Ruby can, and also call it exactly as original (no difference, unlike in Ruby).

And I like having "(" after function name - so it is easier to find in code. AND beginners are not confused by optional options.

hod139
October 5th, 2007, 02:23 PM
Ruby versus Python:

I hope this thread doesn't last as long as this one: (comp.lang.python (http://groups.google.com/group/comp.lang.python/browse_thread/thread/c41594596595e511/028422d707512283?#028422d707512283))

Even the c2 wiki has a page on this: http://c2.com/cgi/wiki?PythonVsRuby

The c2 page links to this particular post (http://groups.google.com/group/comp.lang.python/msg/28422d707512283) in the comp.lang.python discussion.

mssever
October 5th, 2007, 06:30 PM
For completeness, I added same thing in Python.
Well, the Python way is certainly simpler in this case. But what would you have to do if you needed to determine which function to call at runtime? For example, in Ruby, you might do something like:
which_method = "foo"
method(which_method).call
But my guess of a Python equivalent (based on your previous example) didn't work.
>>> def something():
... return 42
...
>>> a = something
>>> a()
42
>>> b = "something"
>>> b()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'str' object is not callable

pmasiar
October 5th, 2007, 08:02 PM
Here, Ruby shows his Perl roots and weak typing. Python is strongly typed, you cannot use same methods on function pointer, and on a string which just happens to containt text which just happens be valid function call.

Strong typing is GOOD THING(tm) and this is exactly what Alex Martelli was explaining in his post linked above (why Ruby is more open to runtime tinkering, so Ruby is MORE DANGEROUS in real-life production systems, and why he prefers Python).

To execute string, in strongly typed language you need to use different approach than executing function pointer: you need to evaluate the string with function call (with full understanding that evaluation is dangerous operation, and you need to check the string and be sure you DO want to run it - it is VERY DIFFERENT from just calling function reference - it is different type.



>>> b = "s()"
>>> eval(b)
42


Works like charm, and is still more readable IMHO :-)

Please note than I evaluate REFERENCE to function, not the original function like your Ruby example: it is one more level of indirection, not sure if you can do it in Ruby :-)

Edit: BTW mssever thanks for shifting discussions from "opinions" to code snippets: it is more fun, and better education, than just flaming and holy wars.

aks44
October 5th, 2007, 08:13 PM
Python is strongly typedHuh?


Strong typing is **good thing(tm)** and this is exactly what Alex Martelli was explaining in his post linked above (why Ruby is more open to runtime tinkering, so **more dangerous** in real-life production systems

Welcome to the real world then. :D
(you know why I say that, you know that I'm not serious at all, so let's not argue about that heh? I just couldn't refrain myself when I saw your statement ;))

</troll>

pmasiar
October 5th, 2007, 08:24 PM
Huh?


I am confused what is your surprise: Python is http://en.wikipedia.org/wiki/Strongly_typed, but http://en.wikipedia.org/wiki/Type_system#Dynamic_typing language. Python uses http://en.wikipedia.org/wiki/Late_binding, but is strict in enforcing type at runtime, unlike Perl and Ruby. And in every OOP language, exact code to be run for the object instance has to be found at runtime anyway IIUC, difference is how widely you search.


In Python, you cannot do "5" + 3, it is error.

This is source of Python power and flexibility: it is in the middle between strongly statically typed languages, like C++/Java, and weakly dynamically typed languages, like Ruby and Perl.

Welcome to real world indeed.

ButteBlues
October 5th, 2007, 09:29 PM
It is YOU who misrepresent what YOU said. I re-read whole thread, wasted whole hour, again. You said:



but never provided any link, beyond "it was mentioned couple months ago on slashdot".

In case you weren't paying attention in English class, the quotation you cited states specificities about growth patterns - which have no real bearing on the items experiencing growth.

To say the number of Python numbers is decreasing and the number of Ruby programmers is increasing is not in any way saying that there are more Ruby programmers than Python programmers.

Your logic is based on false dichotomy.


My gut feeling is (and I don't have link :-) ), that **beyond web apps area** (where Rails have the most hype), Python is fastest growing scripting language. Python even has separate conference SciPy: Python in science. Is there a "Ruby in science" conference? Every time I see Ruby mentioned it is with Rails, but is much of Ruby beyond Rails? Most of Python usage is beyond web apps.

How is the number or naming of conventions and conferences, which might I remind you are usually sanctioned by interest groups, at all reflective of the languages themselves?


yet you expect ME to do that to support your own claims?

No. What I do expect is trying to legitimately argue a matter as opposed to reciting the same attempt at argumentum a silentio.


I googled trends, and Python won. Good enough for me.

Please, explain to us how the number of people and the number of news items featuring "ruby programming" and "python programming" are at all indicative of the use of said languages.

Sounds like a false correlation to me.


Alex is established Python guru, with books published, and wiki entry. I take his opinion over anonymous forum ... poster like you any time of day. So far I have no reason to trust your opinion, sorry. AFAIK, you might be just any random Ruby fanboy kid. Alex is **expert**, I was on his lecture at PyCon and he is **incredibly** smart and sharp. **Way** beyond mere mortals, if you ask me. Why won't you try to substantiate your claims by links to say blog post of commonly known experts?

Because at the end of the day, blog posts and articles and what-have-you are only opinion, and no matter how popular or cool some people might be, they're still just stating their own opinions? It's not as if their popularity suddenly makes every word they speak fact.


You tried to bluff, I called you on it: it is supposed to be trolling? Linus has good rule: put up or shut up. Or Ruby fanboys are not required to substantiate their claims? Please note when I claim something, I (most times) try to provide a link. You are free to call me on it if I don't.

First and foremost, I called it trolling because argumentum ad hominem is trolling. Attacking the person is not the same as addressing the argument; they are fundamentally different.

As for "calling my bluff", most of anything you've cited has been first and foremost bikeshedding (as is most of the Python-Ruby holy war), but beyond that, most of your "citations" are opinion pieces to begin with, or are based on false correlations.


ah, these are so called "facts" you prefer so strongly? Let me uninstall TG, now I know from "expert" for sure TG is crap. :evil:

No - they're opinions that just happen to be the general opinion of the majority. There are even a lot of Python folk who will argue that Django and TG still aren't up-to-par with Rails. Ruby folk are far from exclusive in their amiable nature in regards to Rails.


Popularity != hype. Or do you claim otherwise? Dj and TG don't need hype, they are solution used (and loved) in Python community, and they are good. Of course they are not perfect - only projects starting with R can be perfect, right? ;-)

Hyped things tend to be fairly popular. Rails, while a wonderful framework (and handily the best out there at the moment), is fairly over-hyped by a lot of zealous people - as such, it's very popular among weblogs and what-have-you.

To bring up the matter of Google Trends, while I've yet to test myself (and such data is truly irrelevant anyway), I do imagine that "Ruby on Rails" would outdo "Python Django" or "Python Turbo Gears".


Of course. It provides 90% of it, with cleaner syntax.

Bike-shedding, and only merely arguable at best. What you call "cleaner syntax", actually results in very crippled behavior on Python's part.


If YOU read links from article you provided, you would find page http://c2.com/cgi/wiki?BlocksInPython - it IMHO explains how to replicate the same functionality. What is missing? Or you think the page is wrong?

The functionality attempts to do the same; however, Ruby (and like-wise, GNU Smalltalk) was designed for such interaction and its model is better-suited to handling blocks properly.


Again, you claim your "facts". How it is crippled? Maybe you have a case of http://c2.com/cgi/wiki?BlubParadox ?

You've never programmed in Lisp have you?


Yes, I AM glad I learned more about why Python (in opinions of experts I trust) is better than Ruby.

So you admit your opinion is based on the opinions of others, and they're opinions don't constitute as fact?


I also learned some more bits about Ruby, and as I said many times and repeated in this thread, Ruby would be my second choice language.

In order of preference, I'd probably do something like so:

1. Scheme
2. ELisp/Common Lisp
3. Ruby / GNU Smalltalk
4. Python / Perl
5. Javascript
6. Java / C#
7. C / C++


Arguing WITH LINKS and explaining your positions helps people understand issues. Of course, being "little lazy", like you was when talking about "Python blocks" does not help nor understanding of issues not building calm discussion of FACTS.

Again, ad hominem does not constitute a rebuttal.


But of course you are free to have your strong opinions, and don't bother with substantiating opinions with facts, you can even pretend that I said "Python is the holy grail" (which I never did - another of YOUR strawmen), if it will make your foot surgery recovery faster.

The Holy Grail comment was meant in earnest: the fact of the matter is, you prefer Python's way of doing things just as much as I prefer Ruby's. The difference is, that while I admitted that much of the differences I prefer are bike-shedding issues, you continued to only complain about my use of opinion without recognizing your own. Hypocrisy is not the most solid foundation for an argument.

ButteBlues
October 5th, 2007, 09:30 PM
In Python, you cannot do "5" + 3, it is error.

Ruby cannot do this either.

That would return an error like so:


>> "5" + 3
TypeError: can't convert Fixnum into String
from (irb):1:in `+'
from (irb):1

aks44
October 5th, 2007, 09:43 PM
I am confused what is your surprise

Oh well, I consider C to be weakly typed (and it indeed is, compared to C++)...

So obviously from *my* POV, saying that Python is "strongly typed" is sort of an heresy. ;)

Now don't get me wrong, that was more of a tongue-in-cheek comment than anything else. I know we don't have the same requirements, so no hard feelings... The day I'll have to design / write a userland program I guess I'll have to adjust my POV. :D

pmasiar
October 5th, 2007, 10:37 PM
In case you weren't paying attention in English class,

My English is mostly self-taught, sorry :-)

Looks like we both agree that:
(A) Reasonable people may prefer Ruby or Python for different reasons. If you won't call Python design "flawed" I wont call Ruby design "flawed".
(B) Ruby is closer to Perl in its dynamism than Python, as mssever example shows
(C) There are more Python programmer than Ruby programmers (Python community is bigger)
(D) You claim that Ruby gains bigger percentage of users, but you cannot find a link supporting it, and because Python has bigger base, even slower percentage growth might mean that bigger python community gains more users, but nobody really knows and you cannot find the link


How is the number or naming of conventions and conferences, which might I remind you are usually sanctioned by interest groups, at all reflective of the languages themselves?

maybe SIZE of community? But if we agree on (C), it is moot.


No. What I do expect is trying to legitimately argue a matter as opposed to reciting the same attempt at argumentum a silentio.

... by YOU repeating same OPINIONS, like "Python blocks are kludgey at best" "design flaw" etc without explaining them, and without even bothering to mention that you don't mean Pytbon blocks (which are just name for indented code), but Python reimplementation of analog of Ruby's blocks? Why should I shut up - just to let you have last misleading word?


Please, explain to us how the number of people and the number of news items featuring "ruby programming" and "python programming" are at all indicative of the use of said languages.

Sounds like a false correlation to me.

I would assume that the more people use a language, the more web pages is about it? IMHO it is still better than your never-delivered link about "Ruby rising".


It's not as if their popularity suddenly makes every word they speak fact.

but every word YOU speak is fact, and I need to accept it and shut up?


First and foremost, I called it trolling because argumentum ad hominem is trolling. Attacking the person is not the same as addressing the argument; they are fundamentally different.

http://en.wikipedia.org/wiki/Argumentum_ad_hominem

but you never delivered facts, links etc. Always only opinions. So I answered by opinions by people who (unlike you) earned trust of the community. Experts. Do you see difference between your opinion, and opinion of an expert?


As for "calling my bluff", most of anything you've cited has been first and foremost bikeshedding (as is most of the Python-Ruby holy war), but beyond that, most of your "citations" are opinion pieces to begin with, or are based on false correlations.

And your mentioning "kludgey at best" and "flawed design" is just opinion of anomymous troll.


No - they're opinions that just happen to be the general opinion of the majority. There are even a lot of Python folk who will argue that Django and TG still aren't up-to-par with Rails. Ruby folk are far from exclusive in their amiable nature in regards to Rails.

but of course you don't have links, right? Did those hackers switched to Rails? And even if they did, I know plenty who did not: bot Dj and TG are alive and kicking, thank you, imminent death is not expected.


Hyped things tend to be fairly popular. Rails, while a wonderful framework (and handily the best out there at the moment), is fairly over-hyped by a lot of zealous people - as such, it's very popular among weblogs and what-have-you.

maybe you should pay more attention at YOUR English classes. Hype == exaggeration. Bonus link: http://en.wikipedia.org/wiki/Technology_hype


To bring up the matter of Google Trends, while I've yet to test myself (and such data is truly irrelevant anyway), I do imagine that "Ruby on Rails" would outdo "Python Django" or "Python Turbo Gears".

Yes, I know I already mentioned that. Ruby is mostly restricted to Rails, while Python is widely used beyond web development, and Dj/TG only recently started to catch up with Rails. We passionately agree here.


Bike-shedding, and only merely arguable at best. What you call "cleaner syntax", actually results in very crippled behavior on Python's part.

Another example of your well-researched and substantiated arguments. :-)


The functionality attempts to do the same; however, Ruby (and like-wise, GNU Smalltalk) was designed for such interaction and its model is better-suited to handling blocks properly.

"properly" can be translated as "doing exactly same thing, using same syntax sugar, like Ruby does"? C2 has page about Python reimplementation of Ruby blocks with examples, it is good enough for me.



You've never programmed in Lisp have you?


How it is relevant? You never programmed in Forth, have you?


So you admit your opinion is based on the opinions of others, and they're opinions don't constitute as fact?

I admit that I trust the opinions of known Python experts more than the opinion of an anonymous forum poster. :-)


Again, ad hominem does not constitute a rebuttal.

You consider comparing your opinion, with opinion of known expert, to be ad hominem?


The difference is, that while I admitted that much of the differences I prefer are bike-shedding issues, you continued to only complain about my use of opinion without recognizing your own. Hypocrisy is not the most solid foundation for an argument.

casual mentioning of "flawed design" and "kludgey" Python, while exhorting Ruby, is "admitting the differences"?

So you admit that Ruby has exactly as "flawed design" and "kludgey, at best" features as Python has?

ButteBlues
October 5th, 2007, 11:29 PM
Looks like we both agree that:
(A) Reasonable people may prefer Ruby or Python for different reasons. If you won't call Python design "flawed" I wont call Ruby design "flawed".
(B) Ruby is closer to Perl in its dynamism than Python, as mssever example shows
(C) There are more Python programmer than Ruby programmers (Python community is bigger)
(D) You claim that Ruby gains bigger percentage of users, but you cannot find a link supporting it, and because Python has bigger base, even slower percentage growth might mean that bigger python community gains more users, but nobody really knows and you cannot find the link

A and C are correct. B is subjective. D is again misunderstanding what the article (which I've not had time to look for) is saying.

Again, the article stated that the number of Perl, PHP, and Python programmers were all decreasing - and comparing trends indicated that of these, the majority were defecting to either Ruby or Java (with a small amount moving to .NET/ASP.NET). This in turn, resulted in a reported doubling of the number of Ruby programmers within a year.


maybe SIZE of community? But if we agree on (C), it is moot.

That's still non-factual correlation though. That's like saying that because there are a large number of conventions throughout the world that are about the belief that aliens exist, and because few (if any) conventions that deny such beliefs exist, that the majority of people must surely believe aliens exist.


... by YOU repeating same OPINIONS, like "Python blocks are kludgey at best" "design flaw" etc without explaining them, and without even bothering to mention that you don't mean Pytbon blocks (which are just name for indented code), but Python reimplementation of analog of Ruby's blocks? Why should I shut up - just to let you have last misleading word?

It is apparent you are unaware what argumentum a silentio means.


The argument from silence (also called argumentum a silentio in Latin) is generally a conclusion based on silence or lack of contrary evidence.

Your assertions - such as the fact that since I haven't had time to find the article mentioned above somehow meaning that such an article does not exist - are based on logical fallacies in this instance.


I would assume that the more people use a language, the more web pages is about it? IMHO it is still better than your never-delivered link about "Ruby rising".

False correlation.

See: Silent Majority vs. Loud Minority


but every word YOU speak is fact, and I need to accept it and shut up?

Now, you are implying things and putting words in my mouth that I did not say. Whee strawman.


but you never delivered facts, links etc. Always only opinions. So I answered by opinions by people who (unlike you) earned trust of the community. Experts. Do you see difference between your opinion, and opinion of an expert?

So, because the opinions you presented are those held by more well-known individuals, they're automatically correct, regardless? That's another logical fallacy:

EG: President Bush believes homosexual people are evil: since he is more well-known than I, and our opinions differ, his opinion must be right and mine wrong.


And your mentioning "kludgey at best" and "flawed design" is just opinion of anomymous troll.

You seem to be confusing the concept of having a different opinion with bashing.


but of course you don't have links, right?

There are more Holy Wars on the Internet about this than one could link to.


Did those hackers switched to Rails?

Many of them did. A few went back to PHP. A few went to Java-based solutions.


And even if they did, I know plenty who did not: bot Dj and TG are alive and kicking, thank you, imminent death is not expected.

Did I say otherwise? (Hint: No.)


maybe you should pay more attention at YOUR English classes. Hype == exaggeration. Bonus link: http://en.wikipedia.org/wiki/Technology_hype

As a native English speaker, it's my duty to inform you that popular usage of terms often outweigh any technically correct definition (eg. "gay" is also used as a negative connotation similar to "stupid" et al.). Similar to the example, "hype" is defined in popular usage such that a product is receiving an often unorthodox amount of extremely positive publicity that over-emphasizes the good qualities of a product while eschewing or outright ignoring the bad.

Yes, I know I already mentioned that. Ruby is mostly restricted to Rails, while Python is widely used beyond web development, and Dj/TG only recently started to catch up with Rails. We passionately agree here.


Another example of your well-researched and substantiated arguments. :-)

Ad hominem.


"properly" can be translated as "doing exactly same thing, using same syntax sugar, like Ruby does"? C2 has page about Python reimplementation of Ruby blocks with examples, it is good enough for me.

Syntactic sugar plays a large role in the viability of a language both in industry and as a tool for learning.


How it is relevant? You never programmed in Forth, have you?

It is extremely relevant when talking about lambdas, being that Lisp was the first programming language to develop and use them. Knowing Lisp and understanding the principles and underlying concepts of lambdas therein is critical to understanding why Python's lambda implementation is weak (mind, Ruby's isn't perfect either, but blocks are a fair bit closer than the Python lambda).


You consider comparing your opinion, with opinion of known expert,to be ad hominem?

Attacking the person rather than the argument is the definition of ad hominem.


casual mentioning of "flawed design" and "kludgey" Python, while exhorting Ruby, is "admitting the differences"?

So you admit that Ruby has exactly as "flawed design" and "kludgey, at best" features as Python has?

I admit that Ruby is not perfect, nor the best language to ever be designed (I'd give that to one of the Lisp implementations). But I've never said Ruby was, so it's very much irrelevant.

slavik
October 6th, 2007, 03:12 AM
Ruby vs. Python:
http://www.googlefight.com/index.php?lang=en_GB&word1=ruby&word2=python

Ruby wins, end of argument. :)

edit: I also think that Perl is the best language ever designed. *puts on flame suit*

edit2: pmasiar, I win :P
http://www.googlefight.com/index.php?lang=en_GB&word1=slavik&word2=pmasiar

Wybiral
October 6th, 2007, 04:08 AM
Ruby vs. Python:
http://www.googlefight.com/index.php?lang=en_GB&word1=ruby&word2=python

Ruby wins, end of argument. :)


lol, try this one: http://www.googlefight.com/index.php?lang=en_GB&word1=ruby+programming&word2=python+programming

My guess is there are more people Googling precious gems than snakes.

slavik
October 6th, 2007, 04:11 AM
lol, try this one: http://www.googlefight.com/index.php?lang=en_GB&word1=ruby+programming&word2=python+programming

My guess is there are more people Googling precious gems than snakes.
who cares, I beat you, too! :-P

http://www.googlefight.com/index.php?lang=en_GB&word1=slavik&word2=wybiral

Wybiral
October 6th, 2007, 04:13 AM
who cares, I beat you, too! :-P

http://www.googlefight.com/index.php?lang=en_GB&word1=slavik&word2=wybiral

lol, I got hosed.

pmasiar
October 8th, 2007, 04:18 AM
EG: President Bush believes homosexual people are evil: since he is more well-known than I, and our opinions differ, his opinion must be right and mine wrong.

I did not know that you consider Bush to be expert in matters related to homosexual people. :-)

BTW in this matter, I agree with you. :-)

Really, is hard to argue with article you claim it exist but cannot find it. I read many articles claiming the opposite and cannot find them either :-)

And thanks to links from page you provided, I know that EXPERT which opinion Python community trusts (Alex Martelli) looked at the matter and explained why Python is better fit for big projects. So you can repeat "kludgey at best" etc, I don't believe that lambda is THE most important programming construct, and if Ruby's improved lambda is something you want to win Python community over to Ruby, I am not sure that many people will buy it, too. :-)

No, I don't care about lambdas, and if you feel it makes you smarter than me, I don't care either.

If I find any articles about growth of Python community, I'll post it here. But your claim that Python community is shrinking is "a misinformation, at best" :-)

BTW, Python, and not Ruby, was selected as main development language for OLPC, which guarantees future increase of Python community, negating your claims.

Bubs
October 8th, 2007, 04:32 AM
I don't know any languages yet... but I'm trying to learn python. it was a toss between python and ruby, and for a while I was going to go with ruby for rails. I'm a student in 3d and web design. and with the new maya 8.5 they added the capability to script with python, along with the standard MEL script. also I use blender on ocasion and it to uses python as it's embeded scripting language. and python has a few web frameworks for it also, though not as popular as rails.

So I know your goal for learning was programs, but do what I did and just step back and look at your situation. if there is a language that would get you up an moving in doing what you want to do then go with that language first. for me it's python. for you it could be python, C, or even D.

and when I think I know python I can always learn ruby later