Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: A question about imports in wxpython Date: Mon, 8 Feb 2016 09:25:38 -0700 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de duW7uKusujYEzcII9s8WRwlJPQKhTGwVxSS/AbhlGQ+g== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:question': 0.08; 'dict': 0.09; 'globals': 0.09; 'lookup': 0.09; '(but': 0.15; '2016': 0.16; 'do).': 0.16; 'hits': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'trying': 0.22; 'am,': 0.23; '(or': 0.23; 'seems': 0.23; 'feb': 0.23; 'import': 0.24; 'header:In-Reply-To:1': 0.24; 'mon,': 0.24; "i've": 0.25; "doesn't": 0.26; 'example': 0.26; '(which': 0.26; 'point.': 0.27; 'least': 0.27; 'message-id:@mail.gmail.com': 0.27; 'referenced': 0.29; 'starts': 0.29; "i'm": 0.30; 'code': 0.30; 'probably': 0.31; 'received:google.com': 0.35; 'url:org': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'missing': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'some': 0.40; 'save': 0.60; 'to:name:python': 0.84; 'url:phoenix': 0.84; 'url:wxpython': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=LRBglN5OT2O23T0GCcgUvid6IF3gPPaZBrE9Wk4Bcrw=; b=prRLlU/VdFGY8FOOi3F8VWD6PyfuMnxs7eASHsvsUTnkq541Wr3VvY8PYldfvxCNGM bQQKmHzBrbEp44m0ac4rZlE/SA5CR4rs9u/drHBdFbOmBmct4mHJYdcNZnX2JXlISSNj Jch7NuNqIHqCZTo1MBbngEUCFLsybFZSAd/zeKnsgf3j0cRZzFrwhZq8v9vV+hp9VAT8 CMHTiYz2djOW/Sc2W7oj65OvI1vfI4jZOoEpQoM4Lf264Yh7hI3OnihiFu/tgZ50Rk8y u+hE+YrtcKXgKv+xj9iD0uGLrKcbPRDCifr29CF7JpOc3A9TgGma8j/lMEAdXbOqkjC9 Dn6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=LRBglN5OT2O23T0GCcgUvid6IF3gPPaZBrE9Wk4Bcrw=; b=kfBwQC+lRSxjiAm8imSfElqmQNQm1aoW0Ob8EOLoBz9UWmLm1GF14y70t0GDXj8AJg SDBHo2Got4sAGGn0vAVbJI/mCk07oUPSMszhcqLsUWNkk2n6W5gRze5MZ98J6267KAMd jxr5uxDIiK86zdpgCiabVUa+p9j8WgY/Te3iDTXktpnAxl8xT5s2UWHOcKEkoLCY1rRI RvcmoMaCepx6Mtnnewq3+Lihw95lUN+ltOnjUQTM4MXgg8XzA7VpZJf//HuV57VEFSc3 BR4Bmh1J4j+/+nStykpkpy4/7Wbx+xRtI4BUp1eCe04bsZO6wLBNaTeT/PKcvGpOaF7p CHRA== X-Gm-Message-State: AG10YORxOd/T2QCuF+EQuDVjVAlQ+84BWeBn83wDQaS/SC1F3INPXTlkrc/X3MneUgNp5ujj7YtyAo+7Lrs8og== X-Received: by 10.107.11.93 with SMTP id v90mr28033688ioi.188.1454948777474; Mon, 08 Feb 2016 08:26:17 -0800 (PST) In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102687 On Mon, Feb 8, 2016 at 8:44 AM, wrote: > I'm playing with some code that uses the wxpython grid. *Every* > example I have seen starts with the imports:- > > import wx > import wx.grid as Gridlib > > As Gridlib is exactly the same number of characters as wx.grid I > really don't see the point. Am I missing something? You're not missing anything. I've actually never seen that before (or at least never noticed). The first hit when searching "import wx.grid" is http://wxpython.org/Phoenix/docs/html/grid_overview.html which doesn't use the "as" (but I see some hits farther down that do). Probably the author of that code was just trying to save a dict lookup every time "wx.grid" is referenced (which has to look up "wx" in the globals and then "grid" as an attribute). Seems like an unnecessary micro-optimization to me.