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


Groups > comp.lang.python > #25892 > unrolled thread

Re: What's wrong with this code?

Started byEmile van Sebille <emile@fenx.com>
First post2012-07-23 08:36 -0700
Last post2012-07-23 08:36 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#25892 — Re: What's wrong with this code?

FromEmile van Sebille <emile@fenx.com>
Date2012-07-23 08:36 -0700
SubjectRe: What's wrong with this code?
Message-ID<mailman.2483.1343057664.4697.python-list@python.org>
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
>
>


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web