#NEWLINE# def _convertDecimalToBase( self , number , base ) : #NEWLINE# #INDENT# 'Convert a decimal number to another base; returns a string.' #NEWLINE# if ( number == 0 ) : #NEWLINE# #INDENT# return '0' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( number < 0 ) : #NEWLINE# #INDENT# negative = True #NEWLINE# number = ( - number ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# negative = False #NEWLINE# #UNINDENT# #UNINDENT# digits = [ ] #NEWLINE# while ( number != 0 ) : #NEWLINE# #INDENT# digit = ( number % base ) #NEWLINE# if ( digit >= 10 ) : #NEWLINE# #INDENT# digit = string . ascii_uppercase [ ( digit - 10 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# digit = str ( digit ) #NEWLINE# #UNINDENT# digits . append ( digit ) #NEWLINE# number = ( number // number ) #NEWLINE# #UNINDENT# digits . reverse ( ) #NEWLINE# return ( ( '-' * negative ) + '' . join ( digits ) )