On Tue, 16 Oct 2012 08:51:46 -0500, Pradipto Banerjee wrote:

> I am trying to define class, where if I use a statement a = b, then
> instead of "a" pointing to the same instance as "b", it should point to a
> copy of "b", but I can't get it right.

It cannot be done.

Name binding ("variable = value") is a language primitive; it is not
delegated to the object on the LHS (if there even is one; the name doesn't
have to exist at the point that the statement is executed).

You'll have to change the syntax to something which is delegated to
objects, e.g. "a[:] = b" will call "a.__setitem__(slice(None), b)"

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to