def member_definitions(old_resources, new_definition, num_resources, num_new, get_new_id, customise=_identity):
 old_resources = old_resources[(- num_resources):]
 num_create = (num_resources - len(old_resources))
 num_replace = (num_new - num_create)
 for i in range(num_resources):
  if (i < len(old_resources)):
   (old_name, old_definition) = old_resources[i]
   custom_definition = customise(old_name, new_definition)
   if ((old_definition != custom_definition) and (num_replace > 0)):
    num_replace -= 1
    (yield (old_name, custom_definition))
   else:
    (yield (old_name, old_definition))
  else:
   new_name = get_new_id()
   (yield (new_name, customise(new_name, new_definition)))

def member_definitions ( old_resources , new_definition , num_resources , num_new , get_new_id , customise = _identity ) : old_resources = old_resources [ ( - num_resources ) : ] num_create = ( num_resources - len ( old_resources ) ) num_replace = ( num_new - num_create ) for i in range ( num_resources ) : if ( i < len ( old_resources ) ) : ( old_name , old_definition ) = old_resources [ i ] custom_definition = customise ( old_name , new_definition ) if ( ( old_definition != custom_definition ) and ( num_replace > 0 ) ) : num_replace -= 1 ( yield ( old_name , custom_definition ) ) else : ( yield ( old_name , old_definition ) ) else : new_name = get_new_id ( ) ( yield ( new_name , customise ( new_name , new_definition ) ) )
iterate over resource definitions for a scaling group generates the definitions for the next change to the scaling group .