[Python Wpg] Newbie question

Mike Pfaiffer mpfaiffer at callapple.org
Fri Feb 24 19:03:15 EST 2006


On February 24, 2006 03:59 pm, Dave Gabrielson wrote this amazing epistle:
> This one can take some digging if you don't know about it.
> I've been bit before, so I know about it:
>
> import copy
>
> a = copy.deepcopy(b)
>
> will make new versions of everything contained by b for a.
>
> --Dave.

 Thanks. I didn't see anything appropriate in the language reference or 
tutorial. I suspect it's one of those things I missed. I'll try it out in a 
couple of hours (supper is almost ready).

 It looks like one of those OOP things. Correct?

    Later
    Mike



> On February 24, 2006 03:42 pm, Mike Pfaiffer wrote:
> >  I'm redoing an old public domain Apple// BASIC (text) game in Python and
> > submitting it as an article to the magazine in the .signature. I've been
> > working on it for a couple of weeks an hour at a time (it's a simple
> > game). It's a good way to learn the language. I've been following the
> > tutorial and for the most part I can get by experimenting with the
> > examples. I'll admit my technique leaves a lot to be desired (it's my
> > first Python program - I'll clean it up when it's working). With
> > expectations suitably lowered, here is my question...
> >
> >  I have a large list (2D array of single character strings) I want
> > duplicated. Assignment (a = b) copies the pointers and not the values.
> > Rather than copy the list item by item (which isn't out of the question),
> > is there a simple way I haven't seen yet to make a separate copy of the
> > list? I'd like to change one list but not the other.
> >
> >  FYI, I haven't quite got my head around the OO style of programming yet.
> > Hopefully this year I'll try something which gives me the spark of
> > insight I haven't got yet.
> >
> >     Later
> >     Mike

-- 
+----------------------------------------------------------------------+
|Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org |
|   http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.)      |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------



More information about the Winnipeg mailing list