On 10/15/07, Jim Jewett <[EMAIL PROTECTED]> wrote:
> 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.)

Changing the contract of a function can really mess with duck-typing.
If you write a function that internally creates a lowered copy of a
variable (for comparison, say), suddenly you're unintentionally
lowering your argument in-place. Even returning an immutable result
object is a problem, because your contract changes from "I return a
lowered, rjusted copy of my argument" to "I return a lowered rjusted
copy of my argument that -- oops -- is immutable now if it wasn't
before".

Luke
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to