Why does this decorator calls "TypeError: make_sandwich() takes exactly 2 arguments (1 given)"
<p>so I got around to messing with classes and decorators but I can't seem to get past this error: <em>TypeError: make_sandwich() takes exactly 2 arguments (1 given)</em></p>

<p>I tried doing all of it outside of a class and it works. Any ideas on how to make this work inside my sandwich maker?</p>

<pre><code>class SandwichMaker:
    def __init__(self):
        self.sandwich = []
        self.bread = "========"
        self.bacon = " ~~~~~~ "
        self.olives = " oooooo "

    def make_sandwich(self, insides):
        def add_bread():
            self.sandwich.insert(0, self.bread)
            insides()
            self.sandwich.append(self.bread)
        return add_bread

    def add_bacon(self):
        return self.bacon

    def add_olives(self):
        return self.olives

    @make_sandwich
    def print_sandwich(self):
        for i in range(len(self.sandwich)):
            print self.sandwich[i]

my_sandwich = SandwichMaker()
my_sandwich.add_olives()
my_sandwich.add_bacon()
my_sandwich.print_sandwich()
</code></pre>

<p>edit: hey, so I fixed it thanks to the answers. If anyone wants to grab a fully working, nonsense sandwich printer, below is the final version:</p>

<pre><code>def make_sandwich(insides):
    def add_bread(self):
        bread = "========"
        print bread
        insides(self)
        print bread
    return add_bread

class SandwichMaker:
    def __init__(self):
        self.sandwich = []
        self.bacon = " ~~~~~~ "
        self.olives = " oooooo "

    def add_bacon(self):
        self.sandwich.append(self.bacon)

    def add_olives(self):
        self.sandwich.append(self.olives)

    @make_sandwich
    def print_sandwich(self):
        for i in range(len(self.sandwich)):
            print self.sandwich[i]

my_sandwich = SandwichMaker()
my_sandwich.add_bacon()
my_sandwich.add_olives()
my_sandwich.add_bacon()
my_sandwich.add_bacon()
my_sandwich.print_sandwich()
</code></pre>