def digits(n, b=10):
 b = as_int(b)
 n = as_int(n)
 if (b <= 1):
  raise ValueError('b must be >= 2')
 else:
  (x, y) = (abs(n), [])
  while (x >= b):
   (x, r) = divmod(x, b)
   y.append(r)
  y.append(x)
  y.append(((- b) if (n < 0) else b))
  y.reverse()
  return y

def digits ( n , b = 10 ) : b = as_int ( b ) n = as_int ( n ) if ( b <= 1 ) : raise ValueError ( 'b must be >= 2' ) else : ( x , y ) = ( abs ( n ) , [ ] ) while ( x >= b ) : ( x , r ) = divmod ( x , b ) y . append ( r ) y . append ( x ) y . append ( ( ( - b ) if ( n < 0 ) else b ) ) y . reverse ( ) return y
return the number of digits needed to display a number .