Not sure I wrote the subject line correct,
but the examples might explain if not clear


*** first attempt ***
class pin:
   def __init__ (self):
     self.Name  = 'Unknown Pin'

aap = pin()             # create an instance
aap.Name = 'aap'        # set it's name
print aap.Name          # print it's name
                        # but why should I set it's name ??
print 'aap'             # I can just as well print a constant string !!
                         # (ok there will be an extra check)


*** second attempt ***
class pin2:
   def __init__ (self, naam):
     self.Name  = naam

aap2 = pin2('aap2')     # seems completely redundant to me.
print aap2.Name
print 'aap2'


Can this be achieved without redundancy ?

thanks,
Stef Mientki
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to