Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #6717 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2011-05-31 18:04 +1000 |
| Last post | 2011-05-31 18:04 +1000 |
| 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: scope of function parameters (take two) Chris Angelico <rosuav@gmail.com> - 2011-05-31 18:04 +1000
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2011-05-31 18:04 +1000 |
| Subject | Re: scope of function parameters (take two) |
| Message-ID | <mailman.2310.1306829072.9059.python-list@python.org> |
On Tue, May 31, 2011 at 5:17 PM, Henry Olders <henry.olders@mcgill.ca> wrote: > Clearly, making a copy within the function eliminates the possibility of the > side effects caused by passing in mutable objects. Would having the > compiler/interpreter do this automatically make python so much different? Yes, it would make Python quite different. If suddenly you couldn't pass a mutable object to a function to get it muted (that sounds wrong), then code will break. Also, there's a fairly serious performance penalty to copying everything when it's not necessary. As has been suggested, you can specifically and deliberately cause this effect for any function(s) you wish to "protect" in this way; there's no need to change the language's fundamentals to do it. Chris Angelico
Back to top | Article view | comp.lang.python
csiph-web