%from random import randint %for name, (ref, type_name, obj_repr, size) in referents.items(): %ref = "%s_%s" % (ref, randint(0, 65535))