On 11/16/05, Ian Bicking <[EMAIL PROTECTED]> wrote:
> Basically this:
>
> class MyForm(TableForm):
> foo1 = TextField()
> foo2 = TextField()
>
> Is exactly equivalent to:
>
> MyForm = type(TableForm)('MyForm', (TableForm,), {'foo1':
> TextField(), 'foo2': TextField})
this is probably a little too wacky, it turns out. Consider this case:
class TableForm(Subclassable):
def important_behavior(self):
print "foo"
TableForm = TableForm()
class MyForm(TableForm):
def important_behavior(self):
print "bar"
type(MyForm) -> TableForm
MyForm.important_behavior() -> TypeError (takes 1 argument, 0 given)
Not being able to override behavior would be an evil side effect of it
looking like a class but not actually being a class. There's probably
a way to bind the function to the instance, is there not?
Kevin