Module caching
andrew cooke
andrew at acooke.org
Fri Apr 3 18:50:51 EDT 2009
are you an experienced python programmer?
a lot of newbies post here with problems related to unexpected results
because they make "the usual" mistakes about list mutability and default
function arguments.
i suspect that's not the case here, but it seemed worth mentioning, just
in case.
andrew
Aaron Scott wrote:
> Huzzah, another post.
>
> I just discovered that even physically deleting the variable doesn't
> work.
>
> The module storylab.game has the class InitGame, which contains
> "daemons = {}".
>
> A user runs the code, resulting in some values in "daemons":
> "{'berry2': , 'berry3': , 'berry1': }". These are pickled.
>
> The next user runs the code. I put this in to make sure "daemons" is
> getting reset:
>
> req.write(str(lab.game.settings.daemons))
> del lab.game.settings
> req.write(str(lab.game.settings.daemons))
> lab.game.settings = lab.game.InitGame()
> req.write(str(lab.game.settings.daemons))
>
> Okay, that should wipe out any of the values and leave us with a clean
> slate, right?
>
> {'berry2': , 'berry3': , 'berry1': }failed{'berry2': , 'berry3': ,
> 'berry1': }
>
> Oh, you'd be so lucky.
>
> Why? WHY? Why does these values persist? They persist if I change
> them, they persist if I delete them.
>
> Help... please :(
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
More information about the Python-list
mailing list