I have a quiestion on generating classes in Python with type() function
class A:
class B:
some_field = some_value
object received with A constructor call is as follows:
a = <__main__.A object at 0x040BF730>
B = <class '__main__.A.B'>
some_field = 0
Then I tried to make the same class with type() function
C = type("C", (), { 'D': type('D', (), {'some_field': int()})})
Object received with C constructor call contains D which is not inherited from C obviously:
c = <__main__.C object at 0x040BF930>
D = <class '__main__.D'>
some_field = 0
Is there a method to make the same structure as A() with factory function?