Thursday, April 22, 2010
How to think like a Pythonista
How to think like a Pythonista: "NEVER does Python embark on the HUGE task of _deep_ copying unless you very specifically ask it to -- specifically with function deepcopy of module copy. DEEP copying is a serious matter -- function deepcopy has to watch out for cycles, reproduce any identity of references, potentially follow references to any depth, recursively -- it has to reproduce faithfully a graph of objects referencing each other with unbounded complexity. It works, but of course it can never be as fast as the mundane business of shallow copying (which in turn is never as fast as just handing out one more reference to an existing object, whenever the latter course of action is feasible)."