On Tue, 7 Sep 2010 08:07:11 pm Timmie wrote: > Hello, > I would like to refractor a module I write adding more functiosn and > renaming old ones. > > In order to maintain backward compatibility with old scripts that > reply on those modules, I would like to introduce alias names for the > old functions: [...] > Is this a good approach or are there better suggestions out there in > the Python community for such a purpose?
Sounds fine to me, although some people might disagree. Using aliases in this way is probably best when you only have one or two aliases, rather than dozens. Another approach is to have a compatibility module -- have one module with the functionality, and a second module with aliases. The second module could be simply: from module import old as new, ham as spam, bill as william which creates aliases: "new" instead of "old" "spam" instead of "ham" "william" instead of "bill" Then the caller can either say import module module.ham() or import other_module other_module.spam() -- Steven D'Aprano _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor