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


Groups > comp.lang.python > #25892

Re: What's wrong with this code?

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'subject:code': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'gui': 0.11; 'message-id:@dough.gmane.org': 0.16; 'received:173.11': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'second': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'question': 0.27; 'header:X-Complaints-To:1': 0.28; 'prints': 0.29; "i'm": 0.29; 'expect': 0.31; 'code': 0.31; 'print': 0.32; 'to:addr:python-list': 0.33; 'code:': 0.33; 'thanks': 0.34; 'subject:?': 0.35; 'received:org': 0.36; 'totally': 0.36; 'subject:with': 0.36; 'why': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'first': 0.61; 'as:': 0.75; 'subject:this': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Emile van Sebille <emile@fenx.com>
Subject Re: What's wrong with this code?
Date Mon, 23 Jul 2012 08:36:19 -0700
References <CAMugt-pRmdy5M_18rbGC13-6_aqVOCUHYX4-C-XaPWKh+dYRtg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 173-11-108-137-sfba.hfc.comcastbusiness.net
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1
In-Reply-To <CAMugt-pRmdy5M_18rbGC13-6_aqVOCUHYX4-C-XaPWKh+dYRtg@mail.gmail.com>
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.2483.1343057664.4697.python-list@python.org> (permalink)
Lines 54
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343057664 news.xs4all.nl 6843 [2001:888:2000:d::a6]:57300
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:25892

Show key headers only | View raw


On 7/23/2012 7:50 AM Stone Li said...
> I'm totally confused by this code:
>
> Code:
>
>     a = None
>     b = None
>     c = None
>     d = None
>     x = [[a,b],
>           [c,d]]
>     e,f = x[1]
>     print e,f

This prints the first None,None

>     c = 1
>     d = 2
>     print e,f

And nothing has happened to e or f, so this is the second None,None

Why do you expect 1,2?

Emile



>     e = 1
>     f = 2
>     print c,d
>
> Output:
>
>     None None
>     None None
>     1 2
>
>
> I'm expecting the code as:
>
>     None None
>     1 2
>     1 2
>
>
> What's wrong?
> And this question made my GUI program totally out of control.
> Thanks
>
>


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


Thread

Re: What's wrong with this code? Emile van Sebille <emile@fenx.com> - 2012-07-23 08:36 -0700

csiph-web