Ian Kelly wrote: > On Thu, Aug 22, 2013 at 3:26 PM, Prasad, Ramit > <ramit.pra...@jpmorgan.com.dmarc.invalid> wrote: > > Bitswapper wrote: > >> > >> So I have a parent and child class: > >> > >> > >> class Map(object): > >> def __init__(self, name=''): > >> self.mapName = name > >> self.rules = {} > >> > >> class Rule(Map): > >> def __init__(self, number): > >> Map.__init__(self) > >> self.number = number > > > > This means that rules will never have a name. I think you need > > def __init__(self, name='', number=None): > > Map.__init__(self, name) > > self.number = number > > No, that's still wrong. The OP talks abut maps having names, not > rules having names. Unless a Rule is-a Map, which sounds unlikely, > Rule should not be inheriting from Map in the first place. >
Good point. Composition definitely makes more sense as I was confused by how the inheritance was supposed to work anyway. :) ~Ramit This email is confidential and subject to important disclaimers and conditions including on offers for the purchase or sale of securities, accuracy and completeness of information, viruses, confidentiality, legal privilege, and legal entity disclaimers, available at http://www.jpmorgan.com/pages/disclosures/email. -- http://mail.python.org/mailman/listinfo/python-list