Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Selik Newsgroups: comp.lang.python Subject: Re: Sharing package data across files Date: Tue, 28 Jun 2016 22:37:15 +0000 Lines: 19 Message-ID: References: <919dae31-1f29-4278-bdad-d3129aa17b64@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de EK5ipHc6/fhRWz0Nu2iwAgC3PPvd8/f1loPxGko3/ihg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'semantics': 0.09; 'simplified': 0.09; 'subject:files': 0.09; 'example:': 0.10; '2016': 0.16; '__init__.py': 0.16; 'did.': 0.16; 'module?': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'email addr:gmail.com>': 0.18; 'to:2**1': 0.21; 'file.': 0.22; 'trying': 0.22; 'split': 0.23; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'example': 0.26; 'to:no real name:2**1': 0.27; 'message-id:@mail.gmail.com': 0.27; 'to?': 0.27; "i'm": 0.30; 'code': 0.30; 'structure': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; "isn't": 0.35; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'thought': 0.37; 'files': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; 'share': 0.61; 'skip:\xc2 10': 0.67; 'state.': 0.72; 'integrated': 0.72; 'easier,': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=1+L8Jp9qmQ10Ua8eZUZ08Zz4M66fcXvFsDZzJIbQsYQ=; b=eAl3m5wVps8701jagh93EDGWvKr5TtK/GnR9hPScwZdJ4alLKsSilrvHCWunQ1epgn 8W3MP0cSzRJMXH0Hg6F8q7WXdK/szwprUXxbIuqVHkDIInl5Di0bSO7uDGJmZ/X5kfzf Qu+1MqZ/2Mg4I+m4btFNv9XgJIjQ30uypQNdPX3kWIDgxYHSt0FItKoj98Ol+GSQS7TB Htdv/pT1NGLIAE/fbxoivtnaL6vE56/5u18tUDa8WIfiJx4o5zrSUjBecoqOSbwlsC1M liKAj56LEVc0QqhznulW7mMf+cPDfXc7sfNbHzxsi4SFLTTtKXsxx+A6+s2CT5th8o7B tPKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=1+L8Jp9qmQ10Ua8eZUZ08Zz4M66fcXvFsDZzJIbQsYQ=; b=EH3aiue1kYbIxkq3W7gNWYLse+GaMa6ZzU10/yTfTPFXeefhhX64jEQDxAKR50LUNo VnKtfQjIdh+gFFU52bqkfwLP7IbgHq3TWF2U99jXdZwSQfw32XPFsj2nZ0WiA3VUtoKq 1cnMRmBr9r6JyFoTxl4/eg2SlhdK14NKDBKsNMcqFm+vv3UClsCQZEWBRjsb+MD7c3l8 E7auGhhJGO4rbTUyZGRR2egnT+AY85l2TE509DLveayQXNpBFqq7N3cE0ikJTcIb7Aby plo8AanEEeWeFX3yLTcREE/wSrVuOfCa+2hgK1mlR+KH0ovGoQbzbZlg/iiywAyz/yVd Axdg== X-Gm-Message-State: ALyK8tKYHd8K2FxNTTQzaLCRUjLnTs/33VDGDRQVm7ZdSaJN/eRma1aAu5z/HHE39VJH+Vp1fkjon6XeZQz5Ug== X-Received: by 10.55.161.73 with SMTP id k70mr5571107qke.189.1467153444533; Tue, 28 Jun 2016 15:37:24 -0700 (PDT) In-Reply-To: <919dae31-1f29-4278-bdad-d3129aa17b64@googlegroups.com> X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <919dae31-1f29-4278-bdad-d3129aa17b64@googlegroups.com> Xref: csiph.com comp.lang.python:110727 On Tue, Jun 28, 2016 at 3:21 PM wrote: > I'm trying to create a package in which the constituent files share some > state. Apparently, I don't understand scopes, namespaces, and package > semantics as well as I thought I did. Here's the directory structure for a > simplified example: > > example/ > __init__.py > vars.py > funcs.py > > How can I make the example package work like one integrated module even > though in reality it's split across multiple files? > Why do you want to? Isn't easier to have the ``funcs`` module import the ``vars`` module? Even easier, paste all the code into a single file.