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


Groups > comp.lang.python > #18550

Re: a little help

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!rt.uk.eu.org!news-transit.tcx.org.uk!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
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; 'python,': 0.01; 'python.': 0.04; 'interpreter': 0.05; 'behave': 0.07; 'python': 0.08; 'andres': 0.09; 'bind': 0.09; 'garbage': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; '"b"': 0.16; '#python': 0.16; '#the': 0.16; 'bieber': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'message-id:@4ax.com': 0.16; 're-run': 0.16; 'received:wlfraed': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'wed,': 0.17; 'wrote:': 0.18; '2.x': 0.18; 'jan': 0.19; 'memory': 0.21; 'subject:help': 0.21; 'url:home': 0.21; 'versions': 0.23; 'received:166': 0.23; 'command': 0.24; 'compiled': 0.25; 'code': 0.25; 'module': 0.26; 'import': 0.27; 'code,': 0.27; 'do.': 0.28; '(and': 0.28; 'lee': 0.28; 'problem': 0.29; 'exists,': 0.30; 'key,': 0.30; 'objects.': 0.30; 'source': 0.31; 'version': 0.32; 'change.': 0.32; 'objects': 0.32; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'object': 0.33; 'to:addr:python-list': 0.34; 'anything': 0.34; 'explain': 0.36; 'charset:us-ascii': 0.37; 'bound': 0.37; 'variables': 0.37; 'but': 0.37; 'could': 0.37; 'using': 0.38; 'references': 0.38; 'received:org': 0.38; 'created': 0.38; 'else': 0.39; 'to:addr:python.org': 0.40; 'free': 0.64; '2012': 0.67; 'it)': 0.67; 'dennis': 0.73; '-0800': 0.84; 'prolog': 0.84; 'subject:little': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: a little help
Date Thu, 05 Jan 2012 10:35:48 -0500
References <1325719533.2934.YahooMailNeo@web30605.mail.mud.yahoo.com> <CAPTjJmqLPhuOuqzirjMxFk9GeqDhTYFhaoCZitKr+4XtpGVWfg@mail.gmail.com> <1325721417.64653.YahooMailNeo@web30608.mail.mud.yahoo.com> <CAPTjJmqoJR=nPZwjRpAxfjfG2+Cd83AFdt4faxgA8WK3B014eg@mail.gmail.com> <1325723382.2402.YahooMailNeo@web30608.mail.mud.yahoo.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host mobile-166-147-103-033.mycingular.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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>
Newsgroups comp.lang.python
Message-ID <mailman.4452.1325778317.27778.python-list@python.org> (permalink)
Lines 27
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325778317 news.xs4all.nl 6946 [2001:888:2000:d::a6]:55037
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18550

Show key headers only | View raw


On Wed, 4 Jan 2012 16:29:42 -0800 (PST), Andres Soto
<soto_andres@yahoo.com> wrote:

>my mistake is because I have no problem to do that using Prolog which use an interpreter as Python. I thought that the variables in the main global memory space (associated with the command line environment) were kept, although the code that use it could change.

	The key, as with all of Python, is that "variable" NAMES are
references bound to objects. Re-importing a module will bind its name(s)
to new versions of the objects -- but anything created using the former
version are still bound to the older versions of the objects.

>As you explain me, Python behave like a compiled language: any time I make a change in the code, I have to "compile" it again, and re-run (and re-load the data). There is nothing to do.

	import mdl
	b = mdl.aName	#"b" is now bound to the same object as mdl.aName
	#edit the source of mdl
	reload(mdl)		#Python 2.x
	c = mdl.aName		#"c" is now bound to the new object of mdl.aName
	# but "b" is still bound to the old object version even though the 
	# old "mdl.aName" no longer exists, the object stays until ALL names
	# bound to it are deleted or rebound
	b = c		#rebind "b" to the new object version
				#the old object version is now free to be garbage
				#collected (if nothing else was bound to it)
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

Re: a little help Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-01-05 10:35 -0500

csiph-web