Skip to content

Instantly share code, notes, and snippets.

@melvyniandrag
Last active December 19, 2017 16:07
Show Gist options
  • Save melvyniandrag/3a1f5eddff58fdc902c9e32046f89d26 to your computer and use it in GitHub Desktop.
Save melvyniandrag/3a1f5eddff58fdc902c9e32046f89d26 to your computer and use it in GitHub Desktop.
class A( object ):
def __init__( self ):
print("A")
super( A, self ).__init__()
class B( object ):
def __init__( self ):
print("B")
super( B, self ).__init__()
class C( object ):
def __init__( self ):
print("C")
super( C, self ).__init__()
class D( object ):
def __init__( self ):
print("D")
super( D, self ).__init__()
class E( object ):
def __init__( self ):
print("E")
super( E, self ).__init__()
class K1( A, B, C ):
def __init__( self ):
print("K1")
super( K1, self ).__init__()
class K2( D, B, E ):
def __init__( self ):
print("K2")
super( K2, self ).__init__()
class K3( D, A ):
def __init__( self ):
print("K3")
super( K3, self ).__init__()
class Z( K1, K2, K3):
def __init__( self ):
print("Z")
super( Z, self ).__init__()
print( Z.mro() )
z = Z()
@melvyniandrag
Copy link
Author

A bit of code to verify the explanation of c3 linearization I found on wikipedia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment