[ZODB-Dev] Re: [Zope3-dev] Persistent module notes and proposal

Casey Duncan casey at zope.com
Mon Jan 5 17:54:02 EST 2004


On Mon, 05 Jan 2004 16:36:24 -0500
Jim Fulton <jim at zope.com> wrote:
[...]
> > 
> > 
> > If I have the following in a module named "bar":
> > 
> > foo = [1,2,3]
> > 
> > and in a module named splat I do:
> > 
> > from bar import foo
> > 
> > Then I change the source of bar to:
> > 
> > foo = [0,1,2,3]
> > 
> > Does the value of "foo" imported in splat also change and when (Next
> > transaction, etc)?
> 
> 
> No. Don't do that. :)

Good to know ;^)

> If you wanted to share a list that way, you'd need to make
> it a persistent list.
> 
> I'm inclined to disallow import of non-persistent objects
> from persistent modules.

I agree. So classes and functions in persistent modules are persistent
automagically?
 
[...]
> > I continue to agree. So we either need to make it impossible to
> > mutate module state (seems unlikely) or somehow make it clear that
> > it is not a supported use or do nothing and expect many people to
> > naively do the wrong thing and let them lose.
> 
> Yup.  A possibility is to really only allow a few types (e.g.
> interfaces, classes, functions, tuples, strings, etc.)

That sounds good except my example above would still be a gotcha, no
(just change the list to a tuple)?

In the example I'm not mutating the list, just changing its static
definition in the module.

-Casey



More information about the ZODB-Dev mailing list