Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-31 Thread Raymond Hettinger
On Jul 26, 11:24 am, John Nagle na...@animats.com wrote: A tuple is really a frozen list.  Arguably, frozen objects should have been a general concept.  Conceptually, they're simple - once __init__ has run, there can be no more changes to fields of the object. I would argue that freezing and

Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-27 Thread John Nagle
Steven D'Aprano wrote: On Sun, 26 Jul 2009 11:24:48 -0700, John Nagle wrote: An interesting issue is Python objects, which are always mutable. A dict of Python objects is allowed, but doesn't consider the contents of the objects, just their identity (address). Only built-in types are

Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-27 Thread Benjamin Kaplan
On Sun, Jul 26, 2009 at 2:24 PM, John Naglena...@animats.com wrote: Beni Cherniavsky wrote: On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Tuesday 21 July 2009 15:49:59 Inky 788 wrote: My guess is that it was probably for optimization reasons long ago. I've never

Re: Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-27 Thread Dave Angel
Benjamin Kaplan wrote: On Sun, Jul 26, 2009 at 2:24 PM, John Naglena...@animats.com wrote: Beni Cherniavsky wrote: On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Tuesday 21 July 2009 15:49:59 Inky 788 wrote: snip problem. An interesting

Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-26 Thread John Nagle
Beni Cherniavsky wrote: On Jul 22, 9:36 am, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Tuesday 21 July 2009 15:49:59 Inky 788 wrote: My guess is that it was probably for optimization reasons long ago. I've never heard a *good* reason why Python needs both. The good reason is the

Re: Help understanding the decisions *behind* python? - immutable objects

2009-07-26 Thread Steven D'Aprano
On Sun, 26 Jul 2009 11:24:48 -0700, John Nagle wrote: An interesting issue is Python objects, which are always mutable. A dict of Python objects is allowed, but doesn't consider the contents of the objects, just their identity (address). Only built-in types are immutable; one cannot