"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))
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,
> __
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
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