News for hackers. Stuff that matters.
Re:What Python learned from economics by Andys on Wednesday November 19, 2008 @01:03AM (#369227)
I was pleased to find that Ruby isn't like this. So param=[] means param=Array.new, and it gets called every single time you call the method with a parameter missing.
Re:What Python learned from economics by anamax on Wednesday November 19, 2008 @11:07AM (#369558)
> So param=[] means param=Array.new, and it gets called every single time you call the method with a parameter missing.

How far down does Ruby copy? (A default value could be deep.) How does the programer specify a different level (including no copying)?

Python's rule seems bad until you try to use the alternatives outside the single case that they were designed for. Python's rule handles all cases reasonably.

Re:What Python learned from economics by Andys on Thursday November 27, 2008 @10:18PM (#379081)
It doesn't copy anything - it literally is calling "Array.new()" to generate a new array, every time one is needed.

To do it the python way, you'd have to use a global variable to store the array - which is exactly what python is doing for you. Doesn't sound so handy when its put like that, huh?