Re: Sharing package data across files

2016-06-28 Thread scottpakin1
Steven, Very helpful! Thanks for the thorough explanation. -- Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 09:51 am, scottpak...@gmail.com wrote: > On Tuesday, June 28, 2016 at 4:37:45 PM UTC-6, Michael Selik wrote: >> Why do you want to? > > I have a standalone script that grew and grew until reaching an > unmaintainable size. I was hoping to refactor it into a relatively small

Re: Sharing package data across files

2016-06-28 Thread Steven D'Aprano
On Wed, 29 Jun 2016 08:07 am, John Pote wrote: >> from foo import bar >> bar = "oranges" >> >> No code outside of a will see bar as "oranges" because my setting of bar >> merely affected the name "bar" inside module a, it did not "reach into" >> the foo module object and update its "bar".

Re: Sharing package data across files

2016-06-28 Thread scottpakin1
On Tuesday, June 28, 2016 at 5:20:16 PM UTC-6, John Pote wrote: > Correct me if I'm wrong but is not the above only true if bar has been > assigned to and thus references an imutable object? In your example the > string "oranges". > If bar has been assigned to a mutable object in module foo then

Re: Sharing package data across files

2016-06-28 Thread scottpakin1
On Tuesday, June 28, 2016 at 4:37:45 PM UTC-6, Michael Selik wrote: > Why do you want to? I have a standalone script that grew and grew until reaching an unmaintainable size. I was hoping to refactor it into a relatively small top-level script plus a package containing a bunch of relatively

Re: Sharing package data across files

2016-06-28 Thread John Pote
On 28/06/2016 20:55, zackba...@gmail.com wrote: On Tuesday, June 28, 2016 at 1:17:23 PM UTC-6, scott...@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

Re: Sharing package data across files

2016-06-28 Thread Michael Selik
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 >

Re: Sharing package data across files

2016-06-28 Thread zackbaker
On Tuesday, June 28, 2016 at 1:17:23 PM UTC-6, scott...@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

Sharing package data across files

2016-06-28 Thread scottpakin1
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