How to make a copy?

John Roth johnroth at ameritech.net
Sun Oct 14 11:44:49 EDT 2001


"Janos Blazi" <jblazi at hotmail.com> wrote in message
news:3bc9a389_4 at news.newsgroups.com...
> > import copy
> > a=copy.deepcopy(b)
>
> That does not work. I get many messages and at the end I get
> "und-deep-copyable object: <type tkapp>".

This means you need to do the copy yourself. In general, when
you want a copy of a structure, what you really want is a copy of
only part of the structure, and will be quite content with references
to other objects. There's no way that a general utility can know
that.

See the documentation on deepcopy in the copy module.

John Roth





More information about the Python-list mailing list