import math


def int2list2(num,listlen=0,base=2):
   """Return a list of the digits of num, zero padding to produce a list of length at least listlen, to the given base (default binary)"""
   return [(num//base**i)%base for i in range(max(listlen,int(math.ceil(math.log(num,base)))))]