Shashwat Anand wrote:
Ok, this is silly but i want to know is multiple assignment is possible in one line using "+=, -=, *= etc" operators on python 2.6.4

like a,b = 0,1 which is equal to
a = 0
b = 1
on seperate lines.
similarly a = b = 0 which is equal to
a = 0
b = 0
on seperate lines.

Can we pack these two statements in one line ?
a += k
b += k

Can we pack them into one line? Sort of...

a += k; b += k

I was a bit surprised this doesn't work though:

a, b += k, k

Both a,b are incremented by same value 'k'
ofcourse a,b +=k will not work but is there any such option available?

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to