Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31041

Re: surprising behaviour of global dictionaries

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <michele.simionato@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subsequent': 0.04; 'cache': 0.05; 'key.': 0.07; 'before.': 0.09; 'imports': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:dictionaries': 0.16; 'sys.modules': 0.16; 'wrote:': 0.17; 'instance': 0.17; 'library,': 0.17; 'module,': 0.17; "shouldn't": 0.17; 'import': 0.21; 'thanks.': 0.21; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'usually': 0.30; 'another': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'october': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'real': 0.61; 'behavior': 0.64; 'otten': 0.84; 'seriously,': 0.91
Newsgroups comp.lang.python
Date Tue, 9 Oct 2012 08:36:59 -0700 (PDT)
In-Reply-To <mailman.2006.1349796256.27098.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=193.206.66.82; posting-account=gxxH8QkAAABVKeYyAqGOGoaFtdDdsshI
References <40ac555b-71c2-445e-814b-6bd1d037dbee@googlegroups.com> <mailman.2006.1349796256.27098.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 193.206.66.82
MIME-Version 1.0
Subject Re: surprising behaviour of global dictionaries
From Michele Simionato <michele.simionato@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.2007.1349797021.27098.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1349797021 news.xs4all.nl 6969 [2001:888:2000:d::a6]:36926
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31041

Show key headers only | View raw


On Tuesday, October 9, 2012 5:24:17 PM UTC+2, Peter Otten wrote:
> Seriously, you shouldn't use the main script as a library; it is put into 
> 
> the sys.modules cache under the "__main__" key. Subsequent imports under its 
> 
> real name will not find that name in the cache and import another instance 
> 
> of the module, with puzzling effects

Actually I usually never use the main script as a library, this is why I never experience this puzzling behavior before. But now it is clear, thanks.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

surprising behaviour of global dictionaries Michele Simionato <michele.simionato@gmail.com> - 2012-10-09 08:08 -0700
  Re: surprising behaviour of global dictionaries Peter Otten <__peter__@web.de> - 2012-10-09 17:24 +0200
    Re: surprising behaviour of global dictionaries Michele Simionato <michele.simionato@gmail.com> - 2012-10-09 08:36 -0700
      Re: surprising behaviour of global dictionaries Dave Angel <d@davea.name> - 2012-10-09 12:10 -0400
    Re: surprising behaviour of global dictionaries Michele Simionato <michele.simionato@gmail.com> - 2012-10-09 08:36 -0700
    Re: surprising behaviour of global dictionaries Grant Edwards <invalid@invalid.invalid> - 2012-10-09 15:53 +0000
      Re: surprising behaviour of global dictionaries Peter Otten <__peter__@web.de> - 2012-10-09 19:45 +0200

csiph-web