Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: What's wrong with this code? (http://www.velocityreviews.com/forums/t948448-re-whats-wrong-with-this-code.html)

Emile van Sebille 07-23-2012 03:36 PM

Re: What's wrong with this code?
 
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
>
>






All times are GMT. The time now is 02:08 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.