Have you read the Python docs lately?

D

Dan Stromberg

A number of developers have been working on adding examples and useful
advice to the docs.  To sharpen your skills, here are some pieces of
recommended reading:

http://docs.python.org/dev/library/heapq.html#priority-queue-implementation-notes

I believe there isn't any reason why a heap _has_ to be stored in an
array - it's just one of the best representations. Or so I was taught
in school. Though granted, in _Python_ most heaps are arrays, because
the standard library implements them as arrays - perhaps this is what
was meant.

Boy, all this sorting... It seems like it'd be better to use a treap
or red black tree, even when you take into account that Python's sort
will tend to handle adding a single value in O(n) time - because the
treap or red black tree should handle the task in O(logn) time with a
low constant.

http://stromberg.dnsalias.org/~strombrg/treap/
http://newcenturycomputers.net/projects/rbtree.html

A treap should give better average case time than a red black tree,
but a red black tree should give a decent average case with less time
variability.
 
P

Paul Rubin

Raymond Hettinger said:
A number of developers have been working on adding examples and useful
advice to the docs. To sharpen your skills, here are some pieces of
recommended reading:

Thanks, those are nice. The logging one looks especially useful. The
module always looked very confusing to me (too Java-like), and I've
dreaded the day when I might have to figure out how to use it instead of
my own ad-hoc logging. I can sleep better now ;-).
 
T

Terry Reedy

This one in particular was sorely needed, especially its early if-then
discussion of whether to use ‘logging’ at all. Thanks very much to Vinay
Sajip.

Yes, he has been working pretty steadily for some months to improve the
tests, code, and docs.
 
V

Vinay Sajip

This one in particular was sorely needed, especially its early if-then
discussion of whether to use ‘logging’ at all.

For that "when to use logging" part, you can thank Nick Coghlan :)

Thanks are also due to all those who commented on early drafts, which
were put together initially for the 3.2 release. If anyone has any
other improvements to suggest, keep 'em coming!

Regards,

Vinay Sajip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top