How to copy a ClassObject?

Karlo Lozovina _karlo_ at _mosor.net_
Tue Mar 20 14:08:58 CET 2007

Hi all,

how would one make a copy of a class object? Let's say I have:
  class First:
    name = 'First'

And then I write:
  tmp = First

then 'tmp' becomes just a reference to First, so if I write = "Tmp", there goes my So, how to make 'tmp' a copy 
of First, I tried using copy.copy and copy.deepcopy, but that doesn't 

Yes, I can do a:
  class tmp(First):

but I'd rather make a copy than a subclass.


 _______                                        Karlo Lozovina - Mosor
|   |   |.-----.-----.     web: || ICQ#: 10667163
|       ||  _  |  _  |             Parce mihi domine quia Dalmata sum.

More information about the Python-list mailing list