list in a tuple

montyphyton at gmail.com montyphyton at gmail.com
Thu Dec 27 18:00:13 EST 2007


Carl Banks wrote:
> On Dec 27, 12:38 pm, montyphy... at gmail.com wrote:
>> After some tought I must agree that this is a wart more than
>> a bug and that it will probably be best not to mess with it.
>> However, what do you guys think about the print wart in Py3k
>> described athttp://filoxus.blogspot.com/2007/12/python-3000-how-mutable-is-immuta...
>> (im not trying to advertise my blog, I just don't feel like
>> typing the whole problem all over again)?
>
>
> 1. Tuples are immutable.  None of the tuples in your example were
> modified.
>
> The behavior you want (which is not immutability of tuples, which
> Python already has, but *recursive* immutability of all objects
> contained within the tuple) is not an unreasonable thing to ask for,
> but the design of Python and common usage of tuples makes it all but
> impossible at this point.
>
> There is no general way to determine whether an object is mutable or
> not.  (Python would have to add this capability, an extremely
> substantial change, to grant your wish.  It won't happen.)

like I said, I don't think that this behavior should be changed...
therefore, no wish-granting is needed, thank you :)


>
> Tuples are used internally to represent the arguments of a function,
> which are often mutable.
>
> Tuples are sometimes used to return multiple values from a function,
> which could include mutable values.
>
> Tuples are used to specify multiple arguments to a format string, some
> of which could be mutable, though I guess this is going away in Python
> 3.
>
>
> 2. The issue with print in your example is a bug, not a wart.  It'll
> be fixed.
>
> (This is just a guess, but I think it might have something to do with
> the flux of the new bytes type.  The behavior manifested itself when
> trying to print a self-referencing structure probably only because
> that section of code was lagging behind.)
>
>
> 3. You're still top posting, which goes against this group's
> conventions and annoys quite a few people.  When you reply to a
> message, please move your cursor to below the quoted message before
> you begin typing.  Thank you

sorry for top posting...



More information about the Python-list mailing list