Tuples and immutability

Ian Kelly ian.g.kelly at gmail.com
Wed Mar 12 00:06:43 CET 2014

On Tue, Mar 11, 2014 at 10:46 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
>> There are a number of possible solutions.  One possibility would be to
>> copy the Circle as an Ellipse and return the new object instead of
>> mutating it. Then you have the situation where, given a mutable object
>> x that satisfies isinstance(x, Ellipse), the stretch method *may* be
>> able to update the object in-place, or it *may* not.
> That is a really lousy design. Of course we are free to create classes
> with ugly, inconsistent, stupid or unworkable APIs if we like. Python
> won't stop us:

That's true but irrelevant to my point, which was to counter the
assertion that mutable types can always be assumed to be able to
perform operations in-place.

More information about the Python-list mailing list