Re: Unexpected __metaclass__ method behavior

2008-01-06 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Well, you see, I have some database functions that deal with "things" > which are either classes or instances thereof. I though polymorphism > would be a nice way to handle them identically, like: > > def do(thing): thing.Foo() > do(t) > do(Test) > > But never mind,

Re: Unexpected __metaclass__ method behavior

2007-12-31 Thread Arnaud Delobelle
On Dec 31, 12:06 pm, [EMAIL PROTECTED] wrote: > Well, you see, I have some database functions that deal with "things" > which are either classes or instances thereof. I though polymorphism > would be a nice way to handle them identically, like: > > def do(thing): thing.Foo() > do(t) > do(Test) > >

Re: Unexpected __metaclass__ method behavior

2007-12-31 Thread anne . nospam01
Well, you see, I have some database functions that deal with "things" which are either classes or instances thereof. I though polymorphism would be a nice way to handle them identically, like: def do(thing): thing.Foo() do(t) do(Test) But never mind, I now understand that Test.__dict__ can contai

Re: Unexpected __metaclass__ method behavior

2007-12-30 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Dear fellow Pythonians, | | I just stumbled upon the following unexpected behavior: | | class TestType(type): |def Foo(self): return 'TestType Foo' | class Test(object): |__metaclass__ = TestType |def Foo(self): return 'Tes

Re: Unexpected __metaclass__ method behavior

2007-12-30 Thread Michele Simionato
[EMAIL PROTECTED] wrote: > Dear fellow Pythonians, > > I just stumbled upon the following unexpected behavior: > > class TestType(type): > def Foo(self): return 'TestType Foo' > class Test(object): > __metaclass__ = TestType > def Foo(self): return 'Test Foo' > t = Test() > print t.Fo