Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #100968
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.freenet.ag!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Peter Otten <__peter__@web.de> |
| Newsgroups | comp.lang.python |
| Subject | Re: Cannot get the value from dogpile.cache from different modules. |
| Date | Tue, 29 Dec 2015 20:11:17 +0100 |
| Organization | None |
| Lines | 49 |
| Message-ID | <mailman.58.1451416286.11925.python-list@python.org> (permalink) |
| References | <7c8df879-b03a-4323-90c5-3221dd1eced2@googlegroups.com> <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> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | news.uni-berlin.de L/w5KNS70euZLZf4aWmxaQsbBftx6Iu0+dB1qwP4obIw== |
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'assignment': 0.07; 'namespace': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'statements': 0.09; 'example:': 0.10; 'python': 0.10; 'def': 0.13; '"global"': 0.16; '(directly': 0.16; 'indirectly)': 0.16; 'mailinglist': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'variable.': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'tells': 0.18; 'variable': 0.18; '>>>': 0.20; 'simpler': 0.22; 'code,': 0.23; 'sets': 0.23; 'import': 0.24; 'feature': 0.24; 'module': 0.25; 'header:User-Agent:1': 0.26; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'subject:skip:d 10': 0.27; 'function': 0.28; 'cat': 0.29; 'unlikely': 0.29; 'print': 0.30; 'code': 0.30; 'another': 0.32; 'related': 0.32; 'statement': 0.32; 'source': 0.33; 'running': 0.34; 'add': 0.34; 'so,': 0.35; 'something': 0.35; 'problem.': 0.35; 'but': 0.36; 'should': 0.36; 'there': 0.36; 'to:addr:python- list': 0.36; 'subject:: ': 0.37; 'received:org': 0.37; 'thought': 0.37; 'no,': 0.38; 'subject:from': 0.39; 'subject:the': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'your': 0.60; 'subject:get': 0.81; 'complexity': 0.84; 'subject:value': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| X-Gmane-NNTP-Posting-Host | p57bd90e9.dip0.t-ipconnect.de |
| User-Agent | KNode/4.13.3 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Xref | csiph.com comp.lang.python:100968 |
Show key headers only | View raw
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