importing modules
Published: Wednesday, Dec 26, 2007 Last modified: Thursday, Nov 14, 2024
class Bag: def __init__(self): self.data = [] def add(self, x): self.data.append(x) def howmuch(self): return self.data import Bag x = Bag.Bag() Bag.Bag.Howmuch(x) x.Howmuch() from Bag import * x = Bag() Bad.Howmuch(x) x.Howmuch()