On Thu, Jun 26, 2008 at 6:30 PM, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Shrutarshi Basu" <[EMAIL PROTECTED]> wrote > >> def parse_display(self ): >> >> try: >> gram = Grammars(10, 10, self.pc_map, self.hard_rules) >> gram.database = {} > > How is gram.database defined? Is it an instance attribue or > a class attribute? If you have > > class Grammars: > database = {} > def __init__(....): .... > > instead of > > class Grammars: > def __init__(....): > self.database = {} > .... > > Then database will be shared by all instances of Grammars
No, the assignment gram.database = {} will always (at least absent any extra magic) create an instance attribute. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor