<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
On 22.11.2017 07:22, Nick Timkovich wrote:<br>
<blockquote type="cite"
cite="mid:CAHkxivf+FT-OBEhjskiy6X0x5bE+TpVNyVJzFMxBz3Hkjrg6oA@mail.gmail.com">
<meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div class="gmail_extra">Functions are great. I'm a big fan of
functions. However,
<div class="gmail_quote">
<div><br>
</div>
<div>1. Once there are several that all have the same thing
as an argument: thing_operation1(thing, arg),
thing_operation2(thing, arg)...it's about time to bind
them together.</div>
<div>2. And especially for the heap "soft-datatype": once
it's heapified, naively modifying it with other methods
will ruin the heap invariant. **The actual list you pass
around can't be treated as a list.**<br>
</div>
</div>
</div>
</div>
</blockquote>
<br>
Two important aspects to which I want to add some thoughts.<br>
<br>
The reason why I created xheap was because I actually needed a more
complex datastructure which required more bookkeeping:<br>
<br>
1) custom orders on the same data (list)<br>
2) fast removal from within the heap<br>
<br>
The plain "Heap" implementation (object wrapper of heapq) was just
for the sake of completion.<br>
<br>
Cheers,<br>
Sven<br>
<br>
PS: I tend to think that implementing xheap was easier BECAUSE the
stdlib provided a function-only heap implementation. Nonetheless,
both ways do have their merits.<br>
</body>
</html>