Renaming of functions with preservation of backward compatibility

Viewed 10087

I refactor my old code and want to change the names of functions in accordance with pep8. But I want to maintain backward compatibility with old parts of system (a complete refactoring of the project is impossible because function names is a part of the API and some users use the old client code).

Simple example, old code:

def helloFunc(name):
    print 'hello %s' % name

New:

def hello_func(name):
    print 'hello %s' % name

But both functions should work:

>>hello_func('Alex')
>>'hello Alex'
>>helloFunc('Alf')
>>'hello Alf'

I'm thinking about:

def helloFunc(name):
    hello_func(name)

, but I do not like it (in project about 50 functions, and it will look a messy, I think).

What is the best way to do it(excluding duplication ofcource)? Is it possible the creation of a some universal decorator?

Thanks.

4 Answers
Related