3 ms·
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
by Andys 18y ago
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?