Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100968
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Cannot get the value from dogpile.cache from different modules. |
| Date | 2015-12-29 20:11 +0100 |
| Organization | None |
| Message-ID | <mailman.58.1451416286.11925.python-list@python.org> (permalink) |
| References | (1 earlier) <e94e9346-cccd-44cb-b889-75c308921555@googlegroups.com> <mailman.54.1451405867.11925.python-list@python.org> <10871dc8-ee11-41d8-ad3c-c0aab267be64@googlegroups.com> <mailman.56.1451410408.11925.python-list@python.org> <8c87a009-57f7-45c6-bbf8-5c51411758e1@googlegroups.com> |
xeon Mailinglist wrote:
> No, I cannot get a simpler example. The simpler example works, and in my
> code, it doesn't.
Then you have to add/remove complexity until you find the problematic
statements.
> I thought that it was something related to the variable
> `region`, but I declare it as global.
The "global" statement tells a function that a name in the module namespace
should be used even though there is an assignment to that name inside the
function. Example:
_value = 0
def next_int():
global _value
_value += 1
return _value
It is unlikely that this feature will affect your problem.
> So, I think that all the sets will
> go to the same variable.
You can add print statements to your getters/setters
>>> from dogpile.cache import make_region
>>> region = make_region()
>>> region.configure("dogpile.cache.memory")
<dogpile.cache.region.CacheRegion object at 0x7f61f60cafd0>
>>> region.backend
<dogpile.cache.backends.memory.MemoryBackend object at 0x7f61f5e3e110>
to see if the object IDs are the same (I bet they aren't).
Another shot in the dark: an unobvious source of running code twice is when
you import (directly or indirectly) the main script:
$ cat demo.py
import demo
print "demo"
$ python demo.py
demo
demo
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 03:15 -0800
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 07:20 -0800
Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 17:17 +0100
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:13 -0800
Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 18:33 +0100
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:38 -0800
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 10:22 -0800
Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 20:11 +0100
Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 17:14 +0000
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:23 -0800
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:27 -0800
Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 19:22 +0000
Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 14:57 -0800
Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 23:30 +0000
Re: Cannot get the value from dogpile.cache from different modules. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-29 17:49 -0500
csiph-web