Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.028 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; '(at': 0.03; 'wrote:': 0.15; 'mean,': 0.16; 'realised': 0.16; 'cc:addr:python-list': 0.16; 'pm,': 0.16; 'received:74.125.82.44': 0.19; 'received:mail- ww0-f44.google.com': 0.19; 'seems': 0.20; 'variable': 0.21; 'cc:2**0': 0.21; 'cc:no real name:2**0': 0.22; 'header:In-Reply- To:1': 0.22; 'least,': 0.23; 'code': 0.24; 'hall': 0.26; 'function': 0.26; 'load': 0.26; "i'm": 0.27; 'seeing': 0.28; 'guess': 0.28; 'message-id:@mail.gmail.com': 0.28; 'thu,': 0.28; 'bit': 0.28; 'correct': 0.29; 'import': 0.29; 'code,': 0.29; 'object': 0.30; 'cc:addr:python.org': 0.30; 'module': 0.30; 'case).': 0.30; 'confused': 0.30; 'parent': 0.30; 'done': 0.33; 'quite': 0.34; 'example,': 0.35; 'url:python': 0.36; 'data.': 0.36; 'gotten': 0.37; 'doing': 0.37; 'received:google.com': 0.37; 'but': 0.37; 'using': 0.38; 'could': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'perhaps': 0.39; 'data': 0.39; 'url:docs': 0.39; 'help': 0.39; 'received:74.125.82': 0.39; 'got': 0.39; 'missing': 0.40; 'received:74.125': 0.40; 'would': 0.40; 'your': 0.61; 'simple,': 0.64; 'jun': 0.67; 'wish': 0.70; '3:09': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=qP92cbwU7+xPxyaCkSJWNCoebpv1ebyRB9qZd8rSmGY=; b=xyWFuUm2HTb8s1ALQ875tK0Dr9YyJtZ6GktEx+121iaefgXZO1gTaNj2aRoVM9vfFh ISOQSh4ZLCL2AcW+pX0kKCSRqFdZauPnVGM+O8weVoUKxpiuu8pkUQ5ti/j0e5CLg+d3 52o2jQS09HapHBtQE1fpfqYEquJFLbtfTAn1U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=F9AwVZygiVnkaaHQkonVWwJ580+a9xtKK3fh+IVHyaLzVej0R6ODY7v5xR0zmfLn8Q luqJztD8m2ueP5YAkjt3tpYWe59ppliLpdc2nDJfD2zhERvzmIRmYr1ZdnvP4xwbg/b3 EXoTqacpCHPCCOUHgEMx1ECGBZY6FTTsFcTvA= MIME-Version: 1.0 In-Reply-To: <2cc8ba29-b669-4f1c-aa42-2e518402917c@p13g2000yqh.googlegroups.com> References: <7c6cf5e3-8ba0-45c8-86f8-bf3fc5fa2422@v11g2000prn.googlegroups.com> <2cc8ba29-b669-4f1c-aa42-2e518402917c@p13g2000yqh.googlegroups.com> From: Noah Hall Date: Thu, 23 Jun 2011 15:55:35 +0100 Subject: Re: Project-wide variable... To: Gnarlodious Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 29 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1308840957 news.xs4all.nl 14138 [::ffff:82.94.164.166]:48900 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8303 On Thu, Jun 23, 2011 at 3:09 PM, Gnarlodious wrote: > On Jun 23, 7:59=A0am, Noah Hall wrote: >> >>>from a import x > > I'm doing that: > import Module.Data as Data Well, that's not quite the same. You're using Module.Data as Data - I guess you've done this because you've realised that import Module means you still have to write Module.Data every time. But the correct way to is state exactly which function or object you want - for example, from Module import Data. Simple, right? I mean, you almost had it, but it seems like you've gotten a little confused with various theories. > > However I end up doing it in every submodule, so it seems a little > redundant. I wish I could load the variable in the parent program and > have it be available in all submodules. Am I missing something? Well, generally, if you've got a variable that you need in all your sub-modules, the chances are that your code infrastructure needs a bit of reordering (at least, that's what I find in my case). Without seeing your code, though, I would find it hard to make a judgement on what you need. Perhaps reading up on the documentation will help - http://docs.python.org/tutorial/modules.html#packages Noah.