Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7470
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: __dict__ is neato torpedo! |
| References | <4DF41735.60307@gmail.com> <it17a1$vtl$1@dough.gmane.org> <4DF422A8.303@gmail.com> <BANLkTikWh7+bJ+Yh3Ma_dkYLEmjWE2qRDQ@mail.gmail.com> <mailman.145.1307849343.11593.python-list@python.org> |
| Date | 2011-06-12 13:40 +1000 |
| Message-ID | <877h8rvhst.fsf@benfinney.id.au> (permalink) |
| Organization | Unlimited download news at news.astraweb.com |
Andrew Berg <bahamutzero8825@gmail.com> writes: > On 2011.06.11 10:08 PM, Ian Kelly wrote: > > For immutable objects such as ints, this doesn't matter. For mutable > > objects such as lists, it can: > Well, that's confusing. It's exactly the same as with an ordinary assignment (‘a = b’) in Python. You will likely want to work through the Python Tutorial <URL:http://docs.python.org/tutorial/> and experiment with the samples as you go, in order to ground the Python data model in your mind. > How would I make actual copies? At what level? You can create a new dict or a new list by feeding the esiting one to the constructor for the type. Or you can use the various methods in the ‘copy’ module depending on what you want. Be aware, though, that most Python code gets by just fine without explicitly making copies, and I hardly ever see the ‘copy’ module actually used. Work through the tutorial, understand the data model, and work with it to get better results. -- \ “Give a man a fish, and you'll feed him for a day; give him a | `\ religion, and he'll starve to death while praying for a fish.” | _o__) —Anonymous | Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: __dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 22:28 -0500
Re: __dict__ is neato torpedo! Ben Finney <ben+python@benfinney.id.au> - 2011-06-12 13:40 +1000
Re: __dict__ is neato torpedo! Andrew Berg <bahamutzero8825@gmail.com> - 2011-06-11 23:32 -0500
Re: __dict__ is neato torpedo! Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-11 23:12 -0600
csiph-web