On 26/06/2015 01:57, Ethan Furman wrote:
On 06/25/2015 05:09 PM, Mark Lawrence wrote:
On 26/06/2015 00:59, Chris Angelico wrote:
On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman
wrote:
My attempt at a lambda function fails:
filter(lambda p: (p in c for c in contacts), main)
# ['291.792.9001', '
On 06/25/2015 05:09 PM, Mark Lawrence wrote:
On 26/06/2015 00:59, Chris Angelico wrote:
On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman wrote:
My attempt at a lambda function fails:
filter(lambda p: (p in c for c in contacts), main)
# ['291.792.9001', '291.792.9000']
Besides using a lambda ;)
On 26/06/2015 00:59, Chris Angelico wrote:
On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman wrote:
My attempt at a lambda function fails:
filter(lambda p: (p in c for c in contacts), main)
# ['291.792.9001', '291.792.9000']
Besides using a lambda ;) , what have I done wrong?
This looks like a
On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman wrote:
> My attempt at a lambda function fails:
>
> filter(lambda p: (p in c for c in contacts), main)
> # ['291.792.9001', '291.792.9000']
>
> Besides using a lambda ;) , what have I done wrong?
This looks like a job for a list comprehension!
(Cue t
Ethan Furman wrote:
> I have the following function:
>
> def phone_found(p):
>for c in contacts:
> if p in c:
>return True
>return False
>
> with the following test data:
>
> contacts = ['672.891.7280 x999', '291.792.9000 x111']
> main = ['291.792.9001', '291.792.9000']
>
On Thu, Jun 25, 2015 at 9:59 AM, Ethan Furman wrote:
> I have the following function:
>
> def phone_found(p):
> for c in contacts:
> if p in c:
> return True
> return False
>
> with the following test data:
>
> contacts = ['672.891.7280 x999', '291.792.9000 x111']
> main = ['291.792.
I have the following function:
def phone_found(p):
for c in contacts:
if p in c:
return True
return False
with the following test data:
contacts = ['672.891.7280 x999', '291.792.9000 x111']
main = ['291.792.9001', '291.792.9000']
which works:
filter(phone_found, main)
# ['291.79