Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'puts': 0.07; 'rename': 0.07; 'used.': 0.07; 'scripts': 0.09; 'lawrence': 0.09; '(say': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sys.modules': 0.16; 'mon,': 0.16; 'wrote:': 0.17; 'package.': 0.17; 'feb': 0.19; 'import': 0.21; 'bar.': 0.22; 'engineering,': 0.22; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'could': 0.32; '11,': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'to:addr:python.org': 0.39; 'goal': 0.74; '2013': 0.84; 'isaac': 0.84; 'subject:Import': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=p3VRM5miiE9qSCf0LxTWNk1H2h969+b5xYobl/Vi+jY=; b=j9ytNr7bWdPZSM3s9HHV5bt+3aDUwCkpV6F9M8XBwoW1pC3MbjLXYmlF9Ukr77jokQ I/qomzMMnf7cpHmZi09sg7EV/swWiNbjK7E3n4O48xoLUZUbFDDsdJDSZvJLbF6YE2Sh Yo0BDC/Qv457vlVFHqxvkUy3RD+FON5lvdGHbDHYWUFTrGuJVVGtTqhov6cHyfqM3MV9 bIh7S48c7byxZlTfWbiiEFel3ResTeU5GtScKpSVwI5MyOvmDQBCBe1EoTbKI8Y/EQJ6 sBmKi7BBPzfM+Fv0IDPmAQalHMCzXOV9kRV0vHhqIi/UmTun7THstdL/02kXuQf28roZ o3Tw== MIME-Version: 1.0 X-Received: by 10.52.88.197 with SMTP id bi5mr15105371vdb.58.1360567971559; Sun, 10 Feb 2013 23:32:51 -0800 (PST) In-Reply-To: References: Date: Mon, 11 Feb 2013 18:32:51 +1100 Subject: Re: Import redirects From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1360567980 news.xs4all.nl 6944 [2001:888:2000:d::a6]:35615 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:38653 On Mon, Feb 11, 2013 at 6:28 PM, Mark Lawrence 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. ChrisA