Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7464 > unrolled thread
| Started by | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| First post | 2011-06-11 22:12 -0400 |
| Last post | 2011-06-11 22:12 -0400 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: __dict__ is neato torpedo! Terry Reedy <tjreedy@udel.edu> - 2011-06-11 22:12 -0400
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Date | 2011-06-11 22:12 -0400 |
| Subject | Re: __dict__ is neato torpedo! |
| Message-ID | <mailman.141.1307844750.11593.python-list@python.org> |
On 6/11/2011 9:32 PM, Andrew Berg wrote: > I'm pretty happy that I can copy variables and their value from one You are copying names and their associations, but not the objects or thier values. > 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 -- Terry Jan Reedy
Back to top | Article view | comp.lang.python
csiph-web