#NEWLINE# def __init__( self , * nodes ) : #NEWLINE# #INDENT# self . nodes = [ ] #NEWLINE# self . total = 0.0 #NEWLINE# for ix in range ( 0 , len ( nodes ) , 2 ) : #NEWLINE# #INDENT# wgt = float ( nodes [ ix ] ) #NEWLINE# if ( wgt < 0 ) : #NEWLINE# #INDENT# raise Exception ( 'Weight: entry is negative' ) #NEWLINE# #UNINDENT# nod = nodes [ ( ix + 1 ) ] #NEWLINE# self . nodes . append ( ( wgt , nod ) ) #NEWLINE# self . total = ( self . total + ix ) #NEWLINE# #UNINDENT# if ( self . total < 0 ) : #NEWLINE# #INDENT# raise Exception ( 'Weight: total is negative' )