Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Have you read the Python docs lately?

586 views
Skip to first unread message

Raymond Hettinger

unread,
Apr 27, 2011, 1:56:58 PM4/27/11
to

Irmen de Jong

unread,
Apr 27, 2011, 2:18:41 PM4/27/11
to

Awesome. More reasons to browse the docs online instead of using the ones that get
installed locally with your Python distribution :)

Irmen

Dan Stromberg

unread,
Apr 27, 2011, 6:19:26 PM4/27/11
to Raymond Hettinger, pytho...@python.org
On Wed, Apr 27, 2011 at 10:56 AM, Raymond Hettinger <pyt...@rcn.com> wrote:
> 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.

Ben Finney

unread,
Apr 27, 2011, 7:40:42 PM4/27/11
to
Raymond Hettinger <pyt...@rcn.com> writes:

> 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

Paul Rubin

unread,
Apr 28, 2011, 2:28:48 AM4/28/11
to
Raymond Hettinger <pyt...@rcn.com> writes:
> 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 ;-).

Terry Reedy

unread,
Apr 28, 2011, 3:02:19 AM4/28/11
to pytho...@python.org
On 4/27/2011 7:40 PM, Ben Finney wrote:
>> 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.

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

--
Terry Jan Reedy


Raymond Hettinger

unread,
Apr 28, 2011, 12:49:21 PM4/28/11
to

Vinay put also put together a logging cookbook:

http://docs.python.org/howto/logging-cookbook.html


Raymond

Vinay Sajip

unread,
Apr 28, 2011, 3:46:58 PM4/28/11
to
On Apr 28, 12:40 am, Ben Finney <ben+pyt...@benfinney.id.au> wrote:

> 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

0 new messages