[Python-3000] PEP 3137 plan of attack

Jim Jewett jimjjewett at gmail.com
Mon Oct 15 20:11:35 CEST 2007


On 10/15/07, Gregory P. Smith <greg at krypto.org> wrote:
> On 10/15/07, Terry Reedy <tjreedy at udel.edu> wrote:

> > ...I would think that being able to edit in place would be a reason
> > to use a buffer rather than (immutable) bytes.

> I agree, thats a benefit of a mutable object.  But I think the point about
> not reusing the names with a different behavior is valid so that some
> code can be written to operate on objects with duck type without
> having to know if its mutable or not.

I thought that was the reason to return self instead of None.

If returning the original (but mutated) buffer is a problem, then
there is already a problem, because someone else could already mutate
the original.

(Also note that for duck-typing, it should be OK if the new result
object is always immutable, since you have to handle that case
anyhow.)

-jJ


More information about the Python-3000 mailing list