(newbie) Is there a way to prevent "name redundancy" in OOP ?
S.Mientki-nospam at mailbox.kun.nl
Fri Jan 5 20:09:47 CET 2007
Not sure I wrote the subject line correct,
but the examples might explain if not clear
*** first attempt ***
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 ***
def __init__ (self, naam):
self.Name = naam
aap2 = pin2('aap2') # seems completely redundant to me.
Can this be achieved without redundancy ?
More information about the Python-list