Question about references/copies

Arthur ajsiegel at optonline.com
Sat Aug 28 14:37:10 CEST 2004


On Sat, 28 Aug 2004 11:32:39 +0200, aleaxit at yahoo.com (Alex Martelli)
wrote:

>Henning Kage <c0dec at gmx.de> wrote:
>
>> I'm using Python only for some months now and I'm wondering, whether such
>> assignments as above
>
>"As above" _where_?
>
>> are creating bitwise copies of an object or just
>> recieve a reference. That means I wanted to know, wheter Python in general
>> differs between references and copies:
>> 
>> class someclass:
>>   def __init__( self, otherobject):
>>     self.someattribute = otherobject
>
>Python makes no copy unless you explicitly ask for a copy -- what you
>get is always a reference.  There are several ways to ask for copies --
>the most general and powerful ones you'll find in standard library
>modules copy (both copy.copy and copy.deepcopy -- all other ways of
>asking for a copy, except copy.deepcopy, get shallow copies).

I've felt strongly that this key piece of Python learning would be
and much, much more inevitable if there was a (preferred) consistent
way to ask for a copy, across objects - and/or that the copy module
was something other than one of XXX importable moudles.

That dicts and lists (for example) have totally different syntax for
copy, helps - I promise - to misdirect and confuse. I happen to
consider this entire area a significant wart. I think I am entitled to
consider it so. 

I had tried to bring this up to in various forums, most particularly
edu-sig - where I thought this knid of discussion might be of
particular significance - and was rather rudely asked by Guido to take
it elsewhere.  Where? not clear.

Ray Hettinger asked Gudio for permission to at least put a few words
about the copy module in the tutorial section mentioning a few of the
key importable modules - to at least, I think,. give new users a clue
that there was something of conceptual significance in all this.  And
was refused.

My only participation on python-dev was to ask Gudio to reconsider

And was  - rudely - dismissed. 

I promise Brett C. and Anthony B.  that there is more of a 2-way
street than they might think. For some of us trying to make our own
kind of contribution in our own kind of way.

Art




More information about the Python-list mailing list