Nov. 22, 2017
11:09 a.m.
On Wed, 22 Nov 2017 00:22:00 -0600 Nick Timkovich <prometheus235@gmail.com> wrote:
Functions are great. I'm a big fan of functions. However,
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. 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.**
A third reason: documentation and discoverability. If I type help(some_heapified_list) at the prompt, I get the usual documentation for list methods, not the documentation of heapq functions... Regards Antoine.