Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What language is this?
#21
In Ruby you can use braces also instead of 'end'
Juvenile or not, its easy and a more human way of doing things.
The programming language should be for the programmer, not for the machine.
If you want it the other way, use assembly .

For example, when I start something e.g a block. When I want to finish it I think 'end' as in
Start = Start
End = end

not

Start = Start
end = wtf?

----------------------------------
Ruby has a reference to the class in the class body.
Ruby has continuations. Python does not
Reply
#22
More like
start = start
body = tabbed
end = back to the starting scope

I would rather just press the backspace button once then have to write "end" or use braces. Why would you want to reference to the class in the class body(not bashing you I really don't understand) and as for continuations:
http://blog.ianbicking.org/ruby-python-power.html Wrote:Ruby supports continuations. Python does not (except in Stackless again). Continuations are not widely used in real applications in either world, but they do open up the possibility for things like Borges (how exactly CherryFlow works in the absence of Stackless I'm not sure). One notable use of continuations in Ruby is for breakpoints in debuggers.
Both languages have their ups and downs and again, if I started with Ruby and didn't hear of python until now, I'm sure I would be defending Ruby right now. here is another good article:
http://blog.ianbicking.org/ruby-python-power.html
[Image: izsyo6.jpg]


Reply
#23
(02-27-2010, 08:27 AM)uber1337 Wrote: More like
I would rather just press the backspace button once then have to write "end" or use braces.

And you called us lazy in the other thread becuase we couldn't write 'import random' or what ever it was.

I have used python along time ago, way before, I was learning Ruby, It just never hook me on to it. However python does actually have alot more libries and usfull stuff, then Ruby actualyl has. So +1 to Python.
Reply
#24
(02-28-2010, 12:09 AM)Wolskie Wrote: And you called us lazy in the other thread becuase we couldn't write 'import random' or what ever it was.

I have used python along time ago, way before, I was learning Ruby, It just never hook me on to it. However python does actually have alot more libries and usfull stuff, then Ruby actualyl has. So +1 to Python.
Lol it was a joke, hence the Smile after it. I was somewhat jealous of the fact that there is a built in random module, and then when trilo said "that is why Ruby > Python" I realized it was pretty impractical and just showing him python can do the same thing with a simple import statement. I would give Ruby a shot but right now Python is my main priority.
[Image: izsyo6.jpg]


Reply
#25
(02-20-2010, 09:48 PM)uber1337 Wrote: Not really sure about Ruby but imo Python is the easiest to learn and it has short clear syntax which is just fantastic for sharing/reading snippets. As far as how advanced Python can be when you get into topics such as the internet all I have to say is:
Google, Youtube
As for the example on the site:
Code:
say = "I love Ruby"
puts say
say['love'] = "*love*"
puts say.upcase
5.times { puts say }
Python:
Code:
say = 'I love Python'
print say
say.replace('love', '*love*')
print say.upper() * 5
Not only is the python code one line shorter, it looks pretty Smile

Actually, just to point out, it's not 1 line shorter. The ruby script prints say in uppercase once and then prints say (not uppercased) 5 times. Your python code in ruby would be:
Code:
say = 'I love Ruby'
puts say
say['love'] = "*love*"
5.times {puts say.upcase}
Same amount of lines. Although, it can be shortened:
Code:
say = 'I love Ruby'
puts say
5.times{puts say.sub(/love/,"*love*").upcase}
Ninja
Reply
#26
Nicely pointed out ph4ge.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)