trouble with copy/deepcopy

2005-05-22 Thread Alexander Zatvornitskiy
Привет Mike! 17 мая 2005 в 16:38, Mike Meyer в своем письме к Alexander Zatvornitskiy писал: MM> Actually, it is shared - but only for reference. If you assign to it, MM> you'll create an instance variable of the same name. As Peter MM> explained, if you remove the instance variable, the class

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 >

trouble with copy/deepcopy

2005-05-17 Thread Alexander Zatvornitskiy
Привет 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__(self): MR> self.__gr_on_transp = dict() MR> self.

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=dic

trouble with copy/deepcopy

2005-05-16 Thread Alexander Zatvornitskiy
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 so on And, I want to make full copy of i