def kill_by_priority(e_types=None, melee_types_to_ignore=None, radius=9999): RANGE_TYPES = ['shaman', 'thrower', 'fangrider', 'archer'] DEFAULT_PRIORITY = RANGE_TYPES + ['ogre', 'scout', 'munchkin'] self.say(e_types) e_types = e_types or DEFAULT_PRIORITY self.say(e_types)
The first call of
say throws an exception “Say what?” like for non-declared variable.
Without the say calls python “or trick” just doesn’t work - default value is always returned by the expression even if truthy argument was passed.
I tried explicit if and removing
=None after argument name. That doesn’t work.
Has anyone a workaround for the case?