Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Import redirects

Thread Tools

Re: Import redirects

Chris Angelico
Posts: n/a
On Mon, Feb 11, 2013 at 6:28 PM, Mark Lawrence <(E-Mail Removed)> wrote:
> On 11/02/2013 06:50, Isaac To wrote:
>> I have a package (say "foo") that I want to rename (say, to "bar"), and
>> for compatibility reasons I want to be able to use the old package name
>> to refer to the new package.

> My apologies for the over engineering, but this is the best I could come up
> with.
> import bar as foo

That puts it into sys.modules as bar, though; you'd need to change the
import in every place it's used. If that's acceptable, great, but my
reading of the OP was that the goal was to let other scripts import
foo and get bar.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Import redirects Isaac To Python 0 02-12-2013 02:50 AM
Re: Import redirects Oscar Benjamin Python 0 02-11-2013 12:27 PM
Re: Import redirects Mark Lawrence Python 0 02-11-2013 07:28 AM
Import redirects Isaac To Python 0 02-11-2013 06:50 AM
'max-redirects' A Dickson Cisco 0 02-15-2006 04:43 PM