Re: [Tutor] A question about the self and other stuff

2009-10-26 Thread Alan Gauld
"Khalid Al-Ghamdi" wrote class Robot: population = 0 def __init__(self, name): self.name=name print ('initializing {0}'.format(self.name)) Robot.population+=1 def __del__(self): '''I'm dying''' print ('{0} is being destroyed!'.format(self.name))

Re: [Tutor] A question about the self and other stuff

2009-10-25 Thread Luke Paireepinart
On Sun, Oct 25, 2009 at 10:10 PM, Luke Paireepinart wrote: > > >> 2- in the final few lines where I assign an object to the class, I notice >> that a parameter was entered in the class name, "Robot(D23)", although when >> defining the class I didn't put any arguments for it. >> > Yes you did, > __

Re: [Tutor] A question about the self and other stuff

2009-10-25 Thread Luke Paireepinart
On Sun, Oct 25, 2009 at 8:06 PM, Khalid Al-Ghamdi wrote: > Hi everybody, > So I'm new to python and have questions about the following code: > > def __init__(self, name): > '''initializes the data''' > self.name=name > print ('initializing {0}'.format(self.name)) > > dr

[Tutor] A question about the self and other stuff

2009-10-25 Thread Khalid Al-Ghamdi
Hi everybody, So I'm new to python and have questions about the following code: class Robot: '''Represents a Robot with a name. Deletes and makes Robots for testing perpuses''' #a var for counting the number of Robots population = 0 def __init__(self, name): '''initializes t