class EnglishGreetingProvider(object):

    def get_greeting(self, who):
        return 'Hello %s!' % who


class ConsoleGreeter(object):

    def __init__(self, who, provider=EnglishGreetingProvider):
        self.who = who
self.provider = provider()

def greet(self):
    print(self.provider.get_greeting(self.who))
greeter = ConsoleGreeter(who='World')
greeter.greet()


class FrenchGreetingProvider(object):

    def get_greeting(self, who):
        return 'Bonjour %s!' % who
greeter = ConsoleGreeter(who='World', provider=FrenchGreetingProvider)
greeter.greet()
How does Spring for Python compare with Spring for Java