http://docs.python.org/dev/library/heapq.html#priority-queue-implementation-notes
http://docs.python.org/dev/library/bisect.html#searching-sorted-lists
http://docs.python.org/dev/library/re.html#writing-a-tokenizer
http://docs.python.org/dev/library/cmd.html#cmd-example
http://docs.python.org/dev/library/collections.html#ordereddict-examples-and-recipes
http://docs.python.org/dev/howto/logging.html
http://docs.python.org/dev/howto/sorting.html
http://docs.python.org/dev/library/collections.html#collections.namedtuple
Raymond
python tips on twitter: @raymondh
Awesome. More reasons to browse the docs online instead of using the ones that get
installed locally with your Python distribution :)
Irmen
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.
> http://docs.python.org/dev/library/bisect.html#searching-sorted-lists
>
> http://docs.python.org/dev/library/re.html#writing-a-tokenizer
>
> http://docs.python.org/dev/library/cmd.html#cmd-example
>
> http://docs.python.org/dev/library/collections.html#ordereddict-examples-and-recipes
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.
> 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:
Great stuff, and thank you for directing us to some gems.
> http://docs.python.org/dev/howto/logging.html
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.
--
\ “Without cultural sanction, most or all of our religious |
`\ beliefs and rituals would fall into the domain of mental |
_o__) disturbance.” —John F. Schumaker |
Ben Finney
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 ;-).
Yes, he has been working pretty steadily for some months to improve the
tests, code, and docs.
--
Terry Jan Reedy
Vinay put also put together a logging cookbook:
http://docs.python.org/howto/logging-cookbook.html
Raymond
> 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