[Python-3000] PEP 3137 plan of attack
Guido van Rossum
guido at python.org
Mon Oct 15 21:32:16 CEST 2007
I am not going to explain this further if you still don't get it.
These functions should not modify their argument, and return a copy of
the same type as the original.
I'm fine with new APIs that perform similar things in-place.
--Guido
On 10/15/07, Jim Jewett <jimjjewett at gmail.com> wrote:
> 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
> _______________________________________________
> Python-3000 mailing list
> Python-3000 at python.org
> http://mail.python.org/mailman/listinfo/python-3000
> Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org
>
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list