Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7463
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!feeder.news-service.com!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <bahamutzero8825@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.017 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'warnings': 0.05; 'namespace': 0.09; "object's": 0.09; '>>>': 0.12; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; "'a'": 0.16; 'enlighten': 0.16; 'posting': 0.21; 'variable': 0.21; 'skip:b 20': 0.23; 'pass': 0.27; "i'm": 0.27; 'received:209.85.214': 0.28; 'variables': 0.29; 'class': 0.29; 'this.': 0.31; 'someone': 0.33; 'to:addr:python- list': 0.33; "i've": 0.33; 'header:User-Agent:1': 0.35; 'message- id:@gmail.com': 0.36; 'received:google.com': 0.37; 'received:209.85': 0.37; 'another': 0.37; 'pretty': 0.37; 'hoping': 0.38; 'received:192': 0.38; 'doing': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'really': 0.40; 'received:192.168.1': 0.40; 'watch': 0.60; 'subject:!': 0.67 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:x-enigmail-version:content-type:content-transfer-encoding; bh=8fEUyS/YtfZkplkXOerbDeZsmJa60YiLP6V+pWRO7lY=; b=Bd79ITMKHD6fbYgjSwMmUGYPmByOuVRQKdRi0pyojEW8cbNIygojyvbI1mjcANEuUf 5+UGxHiypn1H3DaUyWhj5x1Ws3jgGVLknqVn41+VFx8y22dV+lFZI3EtydcBhP7mpAuC vQkHmoUAFaIgdzlBlzk7c6w8H5MsqqerFGqCk= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :x-enigmail-version:content-type:content-transfer-encoding; b=O1vsxnTwYFiKdoboY3aqQ1Rzs0LCO+2zSGH/e3fH99tIUR4miIv+HNus8ZGu+LsLfE /Q4mcU4vJxsa5d6BPWsbaqUEF5g0vE+L87KpS9ZMK4/Ukj7PaZxRPC8tzwI6HJCnHd+d IrlihRCXCl1LQp4ZH1i7ARBBwfDesC/cwoiWY= |
| Date | Sat, 11 Jun 2011 20:32:37 -0500 |
| From | Andrew Berg <bahamutzero8825@gmail.com> |
| User-Agent | Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 ThunderBrowse/3.3.5 |
| MIME-Version | 1.0 |
| To | "comp.lang.python" <python-list@python.org> |
| Subject | __dict__ is neato torpedo! |
| X-Enigmail-Version | 1.1.1 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.140.1307842367.11593.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1307842367 news.xs4all.nl 49177 [::ffff:82.94.164.166]:42045 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7463 |
Show key headers only | View raw
I'm pretty happy that I can copy variables and their value from one
object's namespace to another object's namespace with the same variable
names automatically:
class simpleObject():
pass
a = simpleObject()
b = simpleObject()
a.val1 = 1
a.val2 = 2
b.__dict__.update(a.__dict__)
a.val1 = 'a'
>>> a.val1
'a'
>>> a.val2
2
>>> b.val1
1
>>> b.val2
2
The reason I'm posting this is to ask what to watch out for when doing
this. I've seen vague warnings that I don't really understand, and I'm
hoping someone can enlighten me.
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
__dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 20:32 -0500
Re: __dict__ is neato torpedo! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-12 02:13 +0000
Re: __dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 21:28 -0500
Re: __dict__ is neato torpedo! Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-12 08:47 +0000
Re: __dict__ is neato torpedo! Hans Mulder <hansmu@xs4all.nl> - 2011-06-12 17:20 +0200
csiph-web