Re: [Tutor] advice on idiom replacing if test requested

2005-12-11 Thread Brian van den Broek
Danny Yoo said unto the world upon 2005-12-11 22:13: > > On Sun, 11 Dec 2005, Brian van den Broek wrote: > > >>I have a case like this toy code: >> >>import random >>list1 = [1,2,3] >>list2 = ['a', 'b', 'c'] >>item = random.choice(list1 +list2) >>if item in list1: >> others = list2 >>else: >

Re: [Tutor] advice on idiom replacing if test requested

2005-12-11 Thread Danny Yoo
On Sun, 11 Dec 2005, Brian van den Broek wrote: > I have a case like this toy code: > > import random > list1 = [1,2,3] > list2 = ['a', 'b', 'c'] > item = random.choice(list1 +list2) > if item in list1: > others = list2 > else: > others = list1 Hi Brian, This code works, and as long

Re: [Tutor] advice on idiom replacing if test requested

2005-12-11 Thread bob
At 04:15 PM 12/11/2005, Brian van den Broek wrote: >Hi all, > >I have a case like this toy code: > >import random >list1 = [1,2,3] >list2 = ['a', 'b', 'c'] >item = random.choice(list1 +list2) >if item in list1: > others = list2 >else: > others = list1 > > >Another way occurred to me, but

[Tutor] advice on idiom replacing if test requested

2005-12-11 Thread Brian van den Broek
Hi all, I have a case like this toy code: import random list1 = [1,2,3] list2 = ['a', 'b', 'c'] item = random.choice(list1 +list2) if item in list1: others = list2 else: others = list1 Another way occurred to me, but I wonder if I'm being too cute: item = random.choice(list1 +list2)