Karlo Lozovina <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]:
> 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
Silly me, posted a question without Googling first ;>. This seems to be
the answer to my question:
import new
class First:
name = 'First'
tmp = new.classobj('tmp', (First,), {})
After this, tmp is a copy of First, and modifying tmp.name will not affect
First.name.
P.S.
If my code is somehow mistaken and might not function properly in all
cases, please correct me.
Bye,
klm.
--
_______ Karlo Lozovina - Mosor
| | |.-----.-----. web: http://www.mosor.net || ICQ#: 10667163
| || _ | _ | Parce mihi domine quia Dalmata sum.
|__|_|__||_____|_____|
--
http://mail.python.org/mailman/listinfo/python-list