Using Python's isinstance
<p>The following usage of <code>isinstance</code> doesn't seem to work in Python 2.5.2 or 2.6.2:</p>

<pre><code>class BananaCake:
    def __init__(self):
        print 'Banana Cake'

class ChocolateCake:
    def __init__(self):
        print 'Chocolate Cake'

class CakeFactory:
    @staticmethod
    def create(name):
        if name == 'banana':
            return BananaCake
        elif name == 'chocolate':
            return ChocolateCake
        else:
            return None

if __name__ == '__main__':
    banana_cake = CakeFactory.create('banana')
    print isinstance(banana_cake, BananaCake)
</code></pre>

<p>The above <code>isinstance</code> is returning <code>False</code> even though banana_cake is an instance of <code>BananaCake</code>. Does anyone know what I might be missing? I'm performing this check in my test scripts. You should be able to copy and paste the above and run it easily in a Python script.</p>
