Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #110727

Re: Sharing package data across files

From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: Sharing package data across files
Date 2016-06-28 22:37 +0000
Message-ID <mailman.94.1467153451.2358.python-list@python.org> (permalink)
References <919dae31-1f29-4278-bdad-d3129aa17b64@googlegroups.com> <CAGgTfkM20FGgMiDB2L7sLJ4Ua2foj0q9uzRA6X93UCADp0PrTQ@mail.gmail.com>

Show all headers | View raw


On Tue, Jun 28, 2016 at 3:21 PM <scottpakin1@gmail.com> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sharing package data across files scottpakin1@gmail.com - 2016-06-28 12:17 -0700
  Re: Sharing package data across files zackbaker@gmail.com - 2016-06-28 12:55 -0700
    Re: Sharing package data across files John Pote <johnpote@jptechnical.co.uk> - 2016-06-28 23:07 +0100
      Re: Sharing package data across files scottpakin1@gmail.com - 2016-06-28 17:02 -0700
      Re: Sharing package data across files Steven D'Aprano <steve@pearwood.info> - 2016-06-29 10:27 +1000
  Re: Sharing package data across files Michael Selik <michael.selik@gmail.com> - 2016-06-28 22:37 +0000
    Re: Sharing package data across files scottpakin1@gmail.com - 2016-06-28 16:51 -0700
      Re: Sharing package data across files Steven D'Aprano <steve@pearwood.info> - 2016-06-29 10:50 +1000
        Re: Sharing package data across files scottpakin1@gmail.com - 2016-06-28 18:24 -0700

csiph-web