Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36212

Re: reduce expression to test sublist

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'default.': 0.07; 'interpreted': 0.07; 'subject:test': 0.07; 'compute': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subtract': 0.09; 'terry': 0.09; 'will,': 0.09; 'suggest': 0.11; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:expression': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'trying': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'header:X-Complaints-To:1': 0.28; 'loop,': 0.29; 'lists': 0.31; 'to:addr:python-list': 0.33; 'false': 0.35; 'faster': 0.35; 'pm,': 0.35; 'something': 0.35; 'received:org': 0.36; 'turn': 0.36; 'does': 0.37; 'item': 0.37; 'rather': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'soon': 0.70; 'received:fios.verizon.net': 0.84; 'sets,': 0.84; 'angel': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: reduce expression to test sublist
Date Sat, 05 Jan 2013 16:55:50 -0500
References <76cd3945-392e-40d4-9f87-d3956b9521d2@googlegroups.com> <50E877C2.8090208@davea.name>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-173-75-251-66.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0
In-Reply-To <50E877C2.8090208@davea.name>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.146.1357422994.2939.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357422994 news.xs4all.nl 6929 [2001:888:2000:d::a6]:50134
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36212

Show key headers only | View raw


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 item in set1 is found that is 
not in set2.

set(lst1) < set(lst2)

will, and directly return False/True. The OP is trying to compute the 
lst1 < lst2, where lst1 and lst2 are interpreted as sets, rather than as 
sequences with the lexicographic ordering default.

-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

reduce expression to test sublist Asim <asim.r.p@gmail.com> - 2013-01-05 10:25 -0800
  Re: reduce expression to test sublist Dave Angel <d@davea.name> - 2013-01-05 13:58 -0500
  Re: reduce expression to test sublist chaouche yacine <yacinechaouche@yahoo.com> - 2013-01-05 11:59 -0800
  Re: reduce expression to test sublist Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2013-01-05 22:41 +0200
  Re: reduce expression to test sublist Terry Reedy <tjreedy@udel.edu> - 2013-01-05 16:55 -0500
  Re: reduce expression to test sublist Terry Reedy <tjreedy@udel.edu> - 2013-01-05 16:55 -0500
  Re: reduce expression to test sublist Dave Angel <d@davea.name> - 2013-01-05 17:05 -0500

csiph-web