How to use *args and **kwargs in Python
I got your idea and this is my function. It’s not well tested and I will be glad if someone improves it:
def orTypes(unit, *types):
for type in types:
if unit and unit.type == type:
return type
return False
# possible use
enemy = hero.findNearestEnemy()
if enemy and enemy.health > 0 and orTypes(enemy,'witch', 'thrower'):
hero.attack(enemy)