News for hackers. Stuff that matters.
Re:Ruby's not ready by sah on Monday April 07, 2008 @08:01PM (#157318)
As someone who spends most of his time working in Python, the section called One nice thing about Ruby’s scoping made me a little bit jealous. I hate the way Python handles default parameters.

Also, I think glyphobet is a little hard on Ruby's range objects. He says:

Python’s xrange() can also be passed around like a variable, but you test for membership with value in myrange instead of ===.

An important difference there is that "value in xrange(10000)" iterates to find the value, while "(1..10000) === value" does something O(1), like 1 <= value < 10000. Range objects are handy, and different from list constructors like range() and generators like xrange(). But I agree that the ".." and "..." syntax is weird.

Re:Ruby's not ready by glyphobet on Monday April 07, 2008 @08:21PM (#157339)
Ah... You're right. I thought value in xrange(10000) just checked the endpoints, but it appears to iterate. Someone should write a PEP. :)
Re:Ruby's not ready by mdemare on Tuesday April 08, 2008 @10:32AM (#157881)
The syntax may be weird at first, but one gets used to it. More importantly, both inclusive ranges and exclusive ranges are useful. It's convenient to have both. It makes code more readable, compared to having to add a -1 offset.