Automatic debugging of copy by reference errors?
Niels L Ellegaard
niels.ellegaard at gmail.com
Sat Dec 9 08:58:22 EST 2006
Marc 'BlackJack' Rintsch wrote:
> In <1165666093.996141.244760 at n67g2000cwd.googlegroups.com>, Niels L
> Ellegaard wrote:
> > I have been using scipy for some time now, but in the beginning I made
> > a few mistakes with copying by reference.
> But "copying by reference" is the way Python works. Python never copies
> objects unless you explicitly ask for it. So what you want is a warning
> for *every* assignment.
Maybe I am on the wrong track here, but just to clarify myself:
I wanted a each object to know whether or not it was being referred to
by a living object, and I wanted to warn the user whenever he tried to
change an object that was being refered to by a living object. As far
as I can see the garbage collector module would allow to do some of
this, but one would still have to edit the assignment operators of each
of the standard data structures:
http://docs.python.org/lib/module-gc.html
Anyway you are probably right that the end result would be a somewhat
crippled version of python
Niels
More information about the Python-list
mailing list