Elegant copy-by-value

Terry Hancock hancock at anansispaceworks.com
Mon Jan 13 20:18:23 CET 2003


Peter Hansen wrote:
> Andrew Bennetts wrote:
>> In which case, perhaps all they want is the following code:
>>      from copy import copy, deepcopy
>>      __builtins__.copy = copy
>>      __builtins__.deepcopy = deepcopy
> Added to a file called sitecustomize.py somewhere in the set
> of directories in sys.path...

Which means it'll break as soon as someone else tries to use his code. 
Isn't that a very forgettable place? It reminds me of another thread in 
which someone wanted to be able to reach standard library modules even if 
they are overloaded by a local module.  Is this really a wise thing to do? 
Or should such code perhaps go in a __init__.py for whatever package is 
being developed?

Just trying to plan ahead ;-)

Cheers,
Terry


-- 
Anansi Spaceworks
http://www.anansispaceworks.com




More information about the Python-list mailing list