Elegant copy-by-value
Peter Hansen
peter at engcorp.com
Mon Jan 13 14:56:46 EST 2003
Terry Hancock wrote:
>
> 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 ;-)
Good point. That goes back to the original advice of "learn to like it
as it is" instead of jumping through hoops to avoid a little extra typing.
I was just trying to make it as convenient as he seemed to want, by
avoiding those "inconvenient" imports and assignments above.
Thanks for pointing out again how futile this is...
-Peter
More information about the Python-list
mailing list