[Edu-sig] Fw: Python sequences by reference - how to make clear

Guido van Rossum guido@python.org
Thu, 19 Sep 2002 16:30:50 -0400


> > > > Sorry, I may have missed that suggestion amidst your rhetoric.
> > > >
> > > > Assuming you're lobbying for a builtin named copy(), should it be a
> > > > deep copy or a shallow copy?

Arthur, can you please answer this?

> > > Is this question a red herring, Guido? Surely one would ask for both
> > > copy() and deepcopy(), the same functions exposed by the copy
> > > module. Of course, I'm not convinced having them as builtins solves
> > > the real problem. (Which is why I asked if the question was a red
> > > herring.) If anything, having these functions as builtins might lead
> > > to an excessive use of copying by the same individuals who hadn't
> > > yet gotten a handle on mutable versus immutable objects.
> >
> > Exactly.  I'm trying to tease out what Arthur perceived the solution
> > to be to the surprises with object aliasing.
> 
> My contention is simple. And nothing I am in a position to prove, with any
> amount of rhetoric. Copy as built_in simply puts a whole area of
> fundamentals on the table as fundamental. It is as important to understand
> why you are not copying when you are not, as why you are copying when you
> are. "Copy" is not CGI or tokenize.
> 
> If I am convinced that I would have confronted and overcome some of this
> confusion much sooner in the process (and that I am typical) had I found
> copy as a built_in, what is the suggestion for lending some weight to this
> contention?

The usual way to make a case for a language (or library) feature is to
show a simple but recognizably common coding fragment that would have
been made clearer or easier to write (etc.) when the proposed feature
is present.

--Guido van Rossum (home page: http://www.python.org/~guido/)