Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ruby face palm
#1
Been going through this book for kicks:  
Mazes for programmers

The book is written in Ruby and I figured, "Hey, why not just pick up Ruby," while I went through it (even though translating the code to python is fairly trivial).

Despite the constant end tags which I think make everything ugly as hell I just ran into this loveliness.

The following is essentially looping over a range in python and assigning each value to the name index; straight forward:  

0.upto(path.length - 2) do |index| A little weird but fair enough.
0.upto(path.length-2) do |index| Yeah, that seems fine too.
0.upto(path.length -2) do |index|
Error:
`length': wrong number of arguments (given 1, expected 0) (ArgumentError)
... wtf.

Not that I condone the latter's operator spacing, but the fact it means something different is insane.
Reply


Messages In This Thread
Ruby face palm - by Mekire - May-06-2017, 02:19 PM
RE: Ruby face palm - by nilamo - May-09-2017, 09:42 PM
RE: Ruby face palm - by Mekire - May-09-2017, 10:08 PM
RE: Ruby face palm - by micseydel - May-09-2017, 10:17 PM
RE: Ruby face palm - by Ofnuts - May-11-2017, 07:46 PM
RE: Ruby face palm - by nilamo - May-11-2017, 06:23 PM
RE: Ruby face palm - by micseydel - May-11-2017, 09:41 PM
RE: Ruby face palm - by nilamo - May-11-2017, 09:48 PM
RE: Ruby face palm - by micseydel - May-11-2017, 10:23 PM
RE: Ruby face palm - by Mekire - May-11-2017, 10:29 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020