From: Michael Ulm Date: 2006-01-12T21:39:00+09:00 Subject: Re: Newbie question about multiple assignments Alex wrote: > irb(main):091:0> a=1 > => 1 > irb(main):092:0> b=2 > => 2 > irb(main):093:0> a,b=b,a > => [2, 1] > irb(main):094:0> a=1 > => 1 > irb(main):095:0> b=2 > => 2 > irb(main):096:0> a, b = b, a = a, b > => [2, 1, 2] <-- Why? > > What is the order for the assignments > Keep in mind, that a, b = c, d is just shorthand for a, b = [c, d] So, your expression a, b = b, a = a, b gets parsed as a, b = [b, a = a, b] and thus produces the observed behaviour. HTH, Michael -- Michael Ulm R&D Team ISIS Information Systems Austria tel: +43 2236 27551-219, fax: +43 2236 21081 e-mail: michael.ulm@isis-papyrus.com Visit our Website: www.isis-papyrus.com