Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31423
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader03.nrc01.news.zen.net.uk.POSTED!not-for-mail |
|---|---|
| From | Nobody <nobody@nowhere.com> |
| Subject | Re: overriding equals operation |
| Date | Tue, 16 Oct 2012 18:31:45 +0100 |
| User-Agent | Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
| Message-Id | <pan.2012.10.16.17.31.46.151000@nowhere.com> |
| Newsgroups | comp.lang.python |
| References | <mailman.2273.1350395930.27098.python-list@python.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 15 |
| Organization | Zen Internet |
| NNTP-Posting-Host | 67d70ad3.news.zen.co.uk |
| X-Trace | DXC=RFa7SP6Ki;oRSn6?Elm^9`f2FgniPJjgb=dR0\ckLKG`WeZ<[7LZNRf83LEA4?@k<cM2Z^cWRFGAkLOX^AN<ai7e |
| X-Complaints-To | abuse@zen.co.uk |
| Xref | csiph.com comp.lang.python:31423 |
Show key headers only | View raw
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)"
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
overriding equals operation Pradipto Banerjee <pradipto.banerjee@adainvestments.com> - 2012-10-16 08:51 -0500
Re: overriding equals operation Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2012-10-16 16:07 +0200
Re: overriding equals operation Nobody <nobody@nowhere.com> - 2012-10-16 18:31 +0100
Re: overriding equals operation 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-16 21:16 -0700
Re: overriding equals operation Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-17 09:14 +0100
Re: overriding equals operation 88888 Dihedral <dihedral88888@googlemail.com> - 2012-10-16 21:16 -0700
csiph-web