Re: trouble with copy/deepcopy

2005-05-17 Thread Mike Meyer
[EMAIL PROTECTED] (Alexander Zatvornitskiy) writes: > ðÒÉ×ÅÔ Marc! > > 16 ÍÁÑ 2005 × 22:18, Marc 'BlackJack' Rintsch × Ó×ÏÅÍ ÐÉÓØÍÅ Ë All ÐÉÓÁÌ: > > MR> That clears only one dictionary at class level. Which is visible on > MR> both instances. > > MR> class Distribution: > MR> def __init__

Re: trouble with copy/deepcopy

2005-05-17 Thread Peter Otten
Alexander Zatvornitskiy wrote: > Hmm. I don't find definition of "class variable" in manual. I try to test > it on such a simple test and find that such variable is NOT shared between > copies: > > class C: > q=int() > > c1=C() > c2=C() > c1.q=5 > c2.q=10 > print c1.q > #5 > print c2.q > #10 >

Re: trouble with copy/deepcopy

2005-05-16 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Alexander Zatvornitskiy wrote: > class Distribution: > __gr_on_transp=dict() > __ostatok_m=dict() > and so on Those two dicts are *class variables* not *instance variables*! > And, I want to make full copy of it: > d1=Distribution() > d2=copy.deepcopy(d1) > > But, me

Re: trouble with copy/deepcopy

2005-05-16 Thread [EMAIL PROTECTED]
Alexander Zatvornitskiy wrote: > Hello! > > I have trouble with copy/deepcopy. It seems, I just don't understand something. > Please explain where things goes wrong and how to do it the right way. > > I have one class: > > class Distribution: > __gr_on_transp=dict() > __ostatok_m=dict() > and