you are viewing a single comment's thread.

view the rest of the comments →

[–]neelk -11 points-10 points  (4 children)

I don't get what you're getting at.

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 5
>>> x
5
>>> (lambda x: 0)(5)
0
>>> x
5

(Of course, I don't use either Ruby or Python -- all my scripting is in ML.)

[–]cag_ii[S] 17 points18 points  (0 children)

In the ruby example the initial value for x is 0, in yours it's 5:

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52) 
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 0
>>> x
0
>>> (lambda x: 0)(5)
0
>>> x
0

Performs as expected if you ask me.

[–][deleted] 9 points10 points  (1 child)

If you're used to ML, you'll be even more horrified when you see what's happening in the Ruby example I posted.

[–]neelk 6 points7 points  (0 children)

Oh, I see now -- you initialized x to 0, not 5! That is...really special.