I'm have the following class set:
class External(object):
def __init__(self, first, second):
self.first = first
self.second = second
def foo():
print('something')
class Parent(object):
shirt_color = ''
shoes_color = ''
external_class = External(shirt_color, shoes_color)
class SouthParent(Parent):
shirt_color = 'white'
shoes_color = 'blue'
Because SouthParent is a children of Parent and the class variables shirt_color and shoes_color are redefined in the SouthParent class, the expected args that External() would receive should be ('white', 'blue') but the instead it receives ('','')
This is defined this way, to be used in the terminal like SouthParent.external_class.foo() like Django Model ( User.objects.all() )
Externalis actually called,shirt_colorandshoes_colorare not class variables at all; they are simply local variables in the body of theclassstatement that will be added to the class's dictionary once the metaclass actually createsParent.