Re: [Tutor] garbage collection/class question

2013-01-12 Thread Jan Riechers
On 12.01.2013 11:24, Alan Gauld wrote: On 12/01/13 08:09, Jan Riechers wrote: So to rephrase what you and also other wrote: By setting "oakTree = Tree()" I create a new "Tree()" class instance. Now calls to "oakTree.grow()" access functions of the Tree class, by traversing to it's "Superclass"

Re: [Tutor] garbage collection/class question

2013-01-12 Thread Alan Gauld
On 12/01/13 08:09, Jan Riechers wrote: So to rephrase what you and also other wrote: By setting "oakTree = Tree()" I create a new "Tree()" class instance. Now calls to "oakTree.grow()" access functions of the Tree class, by traversing to it's "Superclass" Tree. No, they traverse to its Tree cl

Re: [Tutor] garbage collection/class question

2013-01-12 Thread Jan Riechers
On 12.01.2013 02:19, Mitya Sirenef wrote: Functions are the same, (called methods), but the self object is different for each instance, and represents the instance. Consider that since the logic performed by the method is the same (if it wasn't, you'd define it as a separate method, right?), the

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Mitya Sirenef
On 01/11/2013 04:32 PM, Dave Angel wrote: On 01/11/2013 02:41 PM, Jan Riechers wrote: >> On 10.01.2013 19:50, Mitya Sirenef wrote: >>> On 01/10/2013 09:06 AM, richard kappler wrote: >>> >>> class Tree(object): >>> height = 0 >>> >>> def grow(self): >>> self.height += 1 >>> >>> You may have a do

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Mitya Sirenef
On 01/11/2013 02:41 PM, Jan Riechers wrote: On 10.01.2013 19:50, Mitya Sirenef wrote: >> On 01/10/2013 09:06 AM, richard kappler wrote: >> >> class Tree(object): >> height = 0 >> >> def grow(self): >> self.height += 1 >> >> You may have a dozen of related functions and you can logically group >

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Alan Gauld
On 11/01/13 19:41, Jan Riechers wrote: class Tree(object): height = 0 def grow(self): self.height += 1 Actually one question about those "dozens of related" instances generated by: greenwoodTree = Tree() oakTree = Tree() Both, greenwoodTree and oakTree, are derived f

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Dave Angel
On 01/11/2013 02:41 PM, Jan Riechers wrote: > On 10.01.2013 19:50, Mitya Sirenef wrote: >> On 01/10/2013 09:06 AM, richard kappler wrote: >> >> class Tree(object): >> height = 0 >> >> def grow(self): >> self.height += 1 >> >> You may have a dozen of related functions and you can

Re: [Tutor] garbage collection/class question

2013-01-11 Thread Jan Riechers
On 10.01.2013 19:50, Mitya Sirenef wrote: On 01/10/2013 09:06 AM, richard kappler wrote: class Tree(object): height = 0 def grow(self): self.height += 1 You may have a dozen of related functions and you can logically group them together by making them methods of a class, mak

Re: [Tutor] garbage collection/class question

2013-01-10 Thread Mitya Sirenef
On 01/10/2013 09:06 AM, richard kappler wrote: Class is still something I struggle with. I think I'm finally starting > to get my head wrapped around it, but the discussion in a different > thread has sparked a question. First, please check my understanding: > A class creates objects, it's lik

Re: [Tutor] garbage collection/class question

2013-01-10 Thread Dave Angel
On 01/10/2013 09:06 AM, richard kappler wrote: Since you don't specify Python version or implementation, I'll use CPython version 2.7 for the details below. Jython (for java environments) and other implementations are likely to differ in their garbage collection details. But the effect will be t

Re: [Tutor] garbage collection/class question

2013-01-10 Thread Hugo Arts
On Thu, Jan 10, 2013 at 3:06 PM, richard kappler wrote: > Class is still something I struggle with. I think I'm finally starting to > get my head wrapped around it, but the discussion in a different thread has > sparked a question. First, please check my understanding: > A class creates objects, i

[Tutor] garbage collection/class question

2013-01-10 Thread richard kappler
Class is still something I struggle with. I think I'm finally starting to get my head wrapped around it, but the discussion in a different thread has sparked a question. First, please check my understanding: A class creates objects, it's like a template that allows me to create as many copies as I