appending to list
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Wed Oct 1 12:16:28 EDT 2003
On Wed, 1 Oct 2003 08:49:20 -0700 (PDT), sud jag
<quentapole1 at yahoo.com> wrote:
>Hi,
> Iam a newbie to python. So any help on this is
>deeply appreciated
>
> If I append an instance of a class to a list will
>the list have a copy of the instance or just a
>reference to that instance ? If it is only a reference
>is there something similar to deep copy in case of
>append ?
>
Only a reference. Note though that within the bounds of pure Python
de-referencing is automatic, you can never get hold of the reference
as a Python object. If you want a copy you mst explicitely ask for it
-- check out the copy module, in particular the deepcopy function.
>Thanks,
>quent
>
With my best regards,
G. Rodrigues
More information about the Python-list
mailing list