Path: csiph.com!usenet.pasdenom.info!gegeweb.org!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'charset:iso-8859-7': 0.04; 'plenty': 0.07; 'variables': 0.07; 'inserted': 0.09; 'objects,': 0.09; 'subject: [': 0.09; 'python': 0.11; '*always*': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'mappings,': 0.16; 'pointers,': 0.16; 'sorts': 0.16; 'subject:versus': 0.16; 'elements': 0.16; 'wrote:': 0.18; 'memory': 0.22; 'refers': 0.24; 'header:In-Reply-To:1': 0.27; 'see,': 0.30; 'to?': 0.30; 'message-id:@mail.gmail.com': 0.30; 'usually': 0.31; "d'aprano": 0.31; 'names.': 0.31; 'steven': 0.31; 'lists': 0.32; 'another': 0.32; 'but': 0.35; 'received:google.com': 0.35; 'done': 0.36; 'should': 0.36; 'list': 0.37; 'implement': 0.38; 'thank': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'worry': 0.60; 'refer': 0.63; 'linked': 0.65; 'dict,': 0.84; 'etc,': 0.84; 'subject:gets': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=4f2NhAXZ0QWVKk4e0JDeGOTL6LI/ey43z8BHaueGP9g=; b=PmX4wyaJZrlmo63AMANnjo3Gfk6O9KXgO8Z4GqNPPEBHf59lir7TPAjPetsjY8iHFP Tk9TvpH0cebT1uqJIUoTNzopjOV3UIcJ2rNXwESFJ/QzJACt9STZ5dCFR7EqqRqGX1hJ cAI57miBliHGW2gEukvDIUAlsXAPqPYvRIZUEKE0uVLLSYU9Yvtj3q/YqfuGW5iFcZxi uCx0zi9O59PWnyyP6BpWmDEkjFzd96X1xIf/ARM1hk4gg8SPWxGA3c9FNCuusxNAsVrq N4nq1w1PRansg0HVYh/U6ybkblihfbAeNZFlXBIMeMbPS7p5xNE0oQ92C/folvr6zf+C emXA== MIME-Version: 1.0 X-Received: by 10.52.34.40 with SMTP id w8mr1338624vdi.7.1371550938950; Tue, 18 Jun 2013 03:22:18 -0700 (PDT) In-Reply-To: References: <2bc90d3b-09c2-4315-9357-ff7f039465e0@googlegroups.com> <51bb454c$0$29997$c3e8da3$5496439d@news.astraweb.com> <51beb20c$0$29872$c3e8da3$5496439d@news.astraweb.com> <51c022d5$0$29872$c3e8da3$5496439d@news.astraweb.com> Date: Tue, 18 Jun 2013 20:22:18 +1000 Subject: Re: Variables versus name bindings [Re: A certainl part of an if() structure never gets executed.] From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-7 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371550941 news.xs4all.nl 16000 [2001:888:2000:d::a6]:34920 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48617 On Tue, Jun 18, 2013 at 7:51 PM, =CD=DF=EA=EF=F2 wro= te: > =D3=F4=E9=F2 18/6/2013 12:05 =EC=EC, =EF/=E7 Steven D'Aprano =DD=E3=F1=E1= =F8=E5: > >> Names are *always* linked to objects, not to other names. >> >> a =3D [] >> b =3D a # Now a and b refer to the same list >> a =3D {} # Now a refers to a dict, and b refers to the same list as befo= re > > > I see, thank you Steven. > > But since this is a fact how do you create complicated data structures th= at > rely on various variables pointing one to another liek we did in C++(cann= ot > recall their names) ? Why do you need to? Linked lists, trees, and so on are just tools. They're usually used to implement data structures like mappings, growable arrays, lists that can have elements inserted into them, etc, etc. Python does these sorts of things in better ways. You should not need to worry about memory locations, pointers, etc. Now, if you want to have one object reference another, that can be done in plenty of ways. Check the Python tutorial. ChrisA