In <[EMAIL PROTECTED]>, Karlo Lozovina wrote:

> 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.name = "Tmp", there goes my First.name. So, how to make 'tmp' a copy 
> of First, I tried using copy.copy and copy.deepcopy, but that doesn't 
> work.
> 
> P.S.
> Yes, I can do a:
>   class tmp(First):
>       pass
> 
> but I'd rather make a copy than a subclass.

Why?  Python isn't a prototype based programming language.

Ciao,
        Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to