On Tue, Jun 14, 2011 at 5:11 AM, Ethan Furman wrote:
> I suspect Geremy is referring to your "most of the batteries you're used to,
> included" comment -- which batteries are missing?
Oh! There's a handful of modules that aren't yet available in 3.x,
which might surprise someone who's moving from
For this script, it's guaranteed that whatever tables the script goes
through and processes, there will be no duplicate headers. I didn't
include functionality to deal with duplicates because there won't be
any to begin with! I just wanted to find out the most efficient way of
checking for similar
Chris Angelico wrote:
On Tue, Jun 14, 2011 at 4:20 AM, geremy condra wrote:
I know that, but I mean what were you talking about before if you
weren't talking about cmp?
Not sure what you mean.
I suspect Geremy is referring to your "most of the batteries you're used
to, included" comment -
In article
Chris Angelico wrote:
>If order and duplicates matter, then you want a completely different
>diff. I wrote one a while back, but not in Python. ...
If order and duplicates matter, one might want to look into
difflib. :-)
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake Cit
On Tue, Jun 14, 2011 at 4:20 AM, geremy condra wrote:
> I know that, but I mean what were you talking about before if you
> weren't talking about cmp?
Not sure what you mean. There were other threads before the cmp thread
started. That thread started with, if my memory serves me correctly,
someth
On Mon, Jun 13, 2011 at 10:50 AM, Chris Angelico wrote:
> On Tue, Jun 14, 2011 at 3:46 AM, geremy condra wrote:
>> On Mon, Jun 13, 2011 at 9:30 AM, Chris Angelico wrote:
>>> Ha! That *lengthy* thread started fairly soon after I joined this
>>> list. It was highly... informative. I learned a bit
On Tue, Jun 14, 2011 at 4:11 AM, Chris Angelico wrote:
> The algorithm went
> something like this:
>
> * Start with pointers to beginnings of both lists.
PS. It wasn't C with pointers and the like; iirc it actually used
array indices as the "pointers". Immaterial to the algorithm though.
ChrisA
On Tue, Jun 14, 2011 at 3:58 AM, Dan Stromberg wrote:
>
> This is a beautiful solution, and yet I feel compelled to mention that it
> disregards duplicates within a given list. If you need duplicate
> detection/differencing, it's better to sort each list and then use an
> algorithm similar to the
On Mon, Jun 13, 2011 at 8:09 AM, Chris Angelico wrote:
> On Tue, Jun 14, 2011 at 12:58 AM, Zachary Dziura
> wrote:
> > if set(source_headers) == set(target_headers):
> >similar_headers = len(source_headers)
>
> Since you're making sets already, I'd recommend using set operations -
> same_hea
On Tue, Jun 14, 2011 at 3:46 AM, geremy condra wrote:
> On Mon, Jun 13, 2011 at 9:30 AM, Chris Angelico wrote:
>> Ha! That *lengthy* thread started fairly soon after I joined this
>> list. It was highly... informative. I learned a bit about Python, and
>> a lot about python-list, from the posts t
On Mon, Jun 13, 2011 at 9:30 AM, Chris Angelico wrote:
> On Tue, Jun 14, 2011 at 2:04 AM, Steven D'Aprano
> wrote:
>> On Tue, 14 Jun 2011 01:39:50 +1000, Chris Angelico wrote:
>>
>>> Python: "Batteries Included".
>>>
>>> (Although Python 3 is "Most of the batteries you're used to, included".)
>>
On Tue, Jun 14, 2011 at 2:04 AM, Steven D'Aprano
wrote:
> On Tue, 14 Jun 2011 01:39:50 +1000, Chris Angelico wrote:
>
>> Python: "Batteries Included".
>>
>> (Although Python 3 is "Most of the batteries you're used to, included".)
>
> Oh gods, you're not going to bring up sort(cmp=...) again are yo
On Tue, 14 Jun 2011 01:39:50 +1000, Chris Angelico wrote:
> Python: "Batteries Included".
>
> (Although Python 3 is "Most of the batteries you're used to, included".)
Oh gods, you're not going to bring up sort(cmp=...) again are you
/me ducks and covers
--
Steven
--
http://mail.python
On Tue, Jun 14, 2011 at 1:21 AM, Zachary Dziura wrote:
> Wow! That was a lot easier than I thought it would be! I guess I
> should have done a little bit more research into such operations.
> Thanks a bunch!!
:)
Python: "Batteries Included".
(Although Python 3 is "Most of the batteries you're u
On Jun 13, 11:09 am, Chris Angelico wrote:
> On Tue, Jun 14, 2011 at 12:58 AM, Zachary Dziura wrote:
> > if set(source_headers) == set(target_headers):
> > similar_headers = len(source_headers)
>
> Since you're making sets already, I'd recommend using set operations -
> same_headers is the (le
On Tue, Jun 14, 2011 at 12:58 AM, Zachary Dziura wrote:
> if set(source_headers) == set(target_headers):
> similar_headers = len(source_headers)
Since you're making sets already, I'd recommend using set operations -
same_headers is the (length of the) intersection of those two sets,
and differ
similar_headers = 0
different_headers = 0
source_headers = sorted(source_mapping.headers)
target_headers = sorted(target_mapping.headers)
# Check if the headers between the two mappings are the same
if set(source_headers) == set(target_headers):
similar_headers = len(source_headers)
else:
17 matches
Mail list logo