But it's to long to type, each time you want to print a message, so you define some wrappers:
info=lambda m: print_with_color(color.GRAY, level.INFO, m)
error=lambda m: print_with_color(color.RED, level.ERROR, m)
warning=lambda m: print_with_color(color.YELLOW, level.WARNING, m)
info('hi im an info')
Which works, but it is perhaps nicer to use partial:
info=partial(print_with_color, color.GRAY, level.INFO)
error=partial(print_with_color, color.RED, level.ERROR)
warning=partial(print_with_color, color.YELLOW, level.WARNING)
info('hi im an info')
Partial application saves you more in languages with syntactic support for them. There api producers design their functions with partial application in mind, unlike python where you often wish for an rpartial function because you want to partially apply from "the other side."