Copy operator (was list.remove for Noivces)

Andreas Kostyrka andreas at mtg.co.at
Fri Nov 30 05:32:37 EST 2001


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Donnerstag, 29. November 2001 00:48 schrieb Arthur Siegel:
> 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?
Well, then everything in sys, string (well this is being phased out), etc. 
should be builtin. 
And no, perhaps because I've learned Python quite late (numerically at least 
in my list of programming languages), but I do not know what all the stuff is 
in __builtin__ without looking at the documentation.

Think again: You are talking about the copy module that in the current code 
base is rather seldom used. Why should a function that is that seldom used be 
moved to __builtin__?

> 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
Not, copy/deepcopy are logical after grokking that one works with references.
> 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.
Nope. Namespace polution. Actually, there is already more than enough baggage 
in __builtin__ that nowadays wouldn't be needed there.
And the need to be backwards compatible for the next decades.

> 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)

Obviously there is some contradiction here. Either you are not coming along 
fine, because you don't understand the copy/deepcopy "wart" of Python, or 
it's not that significant a thing if you can be productive without 
understanding it all :)

Actually that's what is (has been *eg*, list comprehensions can be quite 
cryptic) that you do not have to learn all the warts to understand a program.

Andreas
- -- 
Andreas Kostyrka; Raiffeisenstr. 16/9; 2320 Zwölfaxing
Tel: +43/676/4091256; Fax: +43/1/7065299
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE8B2BIHJdudm4KnO0RAlMhAJ9ATSigDOOT8g9/6j2EbdTv6NAwewCeLZT+
l5TaGj/8+lECB6oHvHtDbwI=
=cTPy
-----END PGP SIGNATURE-----




More information about the Python-list mailing list