Python: Calling subclass's method within super method call
<p><strong>EDIT: My assumptions were wrong; the code below does in fact work like I wanted it to. The behaviour I was observing turned out to be caused by another bit of the code I was working with that I overlooked because it looked completely unrelated.</strong></p>

<p>So I have some code structured like this:</p>

<pre><code>class B(object):
    def foo(self):
        print "spam"

    def bar(self):
        do_something()
        self.foo()
        do_something_else()

class C(B):
    def foo(self):
        print "ham"

    def bar(self):
        super(C, self).bar()
        print "eggs"

c = C()
c.bar()
</code></pre>

<p>This would do_something(), print "spam", do_something_else(), and then print "eggs". However, what I <em>want</em> to do is do_something(), print "ham", do_something_else(), and then print "eggs". In other words, I want to call B's bar method from C's bar method, but I want <em>it</em> to call C's foo method, not B's.</p>

<p>Is there a way to do this? Note that in the actual code I'm dealing with, both the B class and the code that actually calls c.bar() are part of an evolving third-party library, so mucking with that would be a last resort.</p>
