# - - - T a x o n . c h i l d K e y
def childKey ( self, childRank ):
'''What .shortTxKey will the next child have?
'''
The child's short key consists of the concatenation of: the parent's short key; zeroes for any missing ranks between the parent and child rank; and the child's birth order plus one, left-zero-padded to the correct length for the child's rank. We'll build a list of these pieces, then concatenate them to return the result.
#-- 1 --
result = [ self.shortTxKey ]
For the function that returns the key length for each
rank, see Section 15.7, “Hier.keyLen(): Find the key length for a
given depth”.
#-- 2 --
# [ result +:= (strings containing N zero digits, where
# N is the sum of the key lengths for all ranks
# between self.rank and childRank) ]
for deepx in range ( self.rank.depth+1, childRank.depth ):
result.append ( '0' * self.hier.keyLen(deepx) )
#-- 3 --
# [ result +:= (len(self)+1) as a string, zero-padded
# to the key length for childRank ]
result.append ( str(len(self)+1).rjust ( childRank.keyLen,
'0' ) )
#-- 4 --
return ''.join(result)