Copy operator (was list.remove for Noivces)

Arthur Siegel ajs at ix.netcom.com
Wed Nov 28 18:48:48 EST 2001


Chris writes -

>What I get from this is that someone using Python had better understand
>how Python name binding, mutable types, copying, and deep copying work
>in order to not get bit eventually. I don't think making it easier tao
>make a trivial copy will help that, rather it will hinder it. If there
>is something you need to learn, the sooner the better!

Yes.  I agree. 'But help me understand what I need to understand,
the sooner the better.'

I had  written -

> One imports copy, like one imports cgi or tokenize. To a beginner, imports
> from outside  modules  is strictly special purpose stuff. In my case it
>was a  long time before much beyond math ,os and sys perhaps, were anything
> more than absolute exotica.

Chris responds -

>If anything, this is a good argument for making copy() and deepcopy() a
>built-in, rather than part of a module.

Yes, I agree. This would accomplish it, probably as well, or better, than
my original suggestion of an operator.  One learning the language will
definitely look into the meaning and use of built-ins before they explore
the
meaning and use of one of a myriad of modules.  My argument, I guess, is
that copy is somehow different from the other modules, in that it is as if
you
are importing a built_in. Is that totally off-base?

Truth is I probably would have limited use for copy in my own code.  But I
am concluding that understanding copy and deepcopy is somehow core Python.
You need to understand why you are not using it, as well as why you are
using it when you are.  That you can get away with [:] is perhaps, in
effect, my
operator.

What is the downside of copy and deepcopy as built_ins.  Unnecessary
performance hits in the majority of mods which don't need it, I expect.
True?

>> a) I could be missing something  (but I would need convincing)

>You make it clear that you are with this statement:

That I am missing *a lot* from a technical viewpoint is abundantly
clear. Do I seem to being *overstating* my technical understanding.

And if Python had no pretense towards being a language suitable
for learning, I would be totally out of place in saying much of
anything here.  But I have in fact put considerable effort into learning
programming - to the extent that I have (and I am coming along
fine, thank you) -  with Python as my first language. Which I think
makes me my own kind of 'expert' - on nothing more than learning to
program - to the extent that I have  -  with Python as a first language
(and I am coming along fine, thank you)

Art









More information about the Python-list mailing list