On 01/05/2013 04:55 PM, Terry Reedy wrote:
> On 1/5/2013 1:58 PM, Dave Angel wrote:
>
>> If you're trying to make a faster loop, then I suggest you look into set
>> differences. Turn both lists into sets, and subtract them. Something
>> like (untested):
>>
>> result = not bool( set(lst1) -
On 1/5/2013 1:25 PM, Asim wrote:
Hi All
The following reduce expression checks if every element of list lst1
is present in list lst2. It works as expected for integer lists but
for lists of strings, it always returns False.
reduce( lambda x,y: (x in lst2) and (y in lst2), lst1)
reduce(lambda
On 1/5/2013 1:58 PM, Dave Angel wrote:
If you're trying to make a faster loop, then I suggest you look into set
differences. Turn both lists into sets, and subtract them. Something
like (untested):
result = not bool( set(lst1) - set(lst2) )
This does not return False as soon as an ite
Asim writes:
> Hi All
>
> The following reduce expression checks if every element of list lst1
> is present in list lst2. It works as expected for integer lists but
> for lists of strings, it always returns False.
>
>reduce( lambda x,y: (x in lst2) and (y in lst2), lst1)
Possibly this:
- Original Message -
From: Asim
To: python-list@python.org
Cc:
Sent: Saturday, January 5, 2013 7:25 PM
Subject: reduce expression to test sublist
Hi All
The following reduce expression checks if every element of list lst1 is present
in list lst2. It works as expected for integer
On 01/05/2013 01:25 PM, Asim wrote:
> Hi All
>
> The following reduce expression checks if every element of list lst1 is
> present in list lst2. It works as expected for integer lists but for lists
> of strings, it always returns False.
>
>reduce( lambda x,y: (x in lst2) and (y in lst2), lst
Hi All
The following reduce expression checks if every element of list lst1 is present
in list lst2. It works as expected for integer lists but for lists of strings,
it always returns False.
reduce( lambda x,y: (x in lst2) and (y in lst2), lst1)
Moreover, for the lists of strings the follo