[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,
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)
>
>
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
<[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
[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