Live data from Hacker News

Have you read your Python Docs Lately?

jessenoller.com

1–10 of 15 posts

Re: Have you read your Python Docs Lately?

#3
Raymond Hettinger is a great Python educator, and also very active on the mailinglists. He gives talks, too:

Easy AI with Python: http://us.pycon.org/2009/conference/schedule/event/71/

Four powerful examples of composing Python tools: http://us.pycon.org/2010/conference/schedule/event/86/

Re: Have you read your Python Docs Lately?

#4
post #3

Raymond Hettinger is a great Python educator, and also very active on the mailinglists. He gives talks, too: Easy AI with Python: http://us.pycon.org/2009/conference/schedule/event/71/ Four powerful examples of composing Python tools: http://us.pycon.org/2010/conference/schedule/event/86/

Yup, I totally forgot to include his talks from the various conferences.

Re: Have you read your Python Docs Lately?

#7

I love python, I really do, and there is a library for everything you can imagine. So when I see things like this: c.most_common()[:-n:-1] # n least common elements For the love of ceiling_cat, how hard is it to implement a least_common method?

Well, that's pretty ugly anyway―what's wrong with:

    reversed(c.most_common())
Although I agree that a least_common function would be more "symmetrical" (don't ask me why c has one and not both), you can create it yourself (and have it not only readable but efficient!) in one line of code.

Re: Have you read your Python Docs Lately?

#8
post #3

Raymond Hettinger is a great Python educator, and also very active on the mailinglists. He gives talks, too: Easy AI with Python: http://us.pycon.org/2009/conference/schedule/event/71/ Four powerful examples of composing Python tools: http://us.pycon.org/2010/conference/schedule/event/86/

there is also this talk from pycon 2011:

Fun with Python's Newer Tools: http://blip.tv/file/4883247

Re: Have you read your Python Docs Lately?

#9
I wish programming documentation in general were divided into two heavily linked parts, one conversational introductory section and one concise and technical reference section (like a manpage). By heavily linked, I mean the "conversational" section should have plenty of links to the reference section inline with the prose and vice versa. I don't like reading references when I don't even see the big picture. On the other hand, I don't like getting too used to intro material because it's too verbose to refer to later. But if the conversational part has links to the reference section and vice versa, I would get into the habit of following the links and gradually familiarizing myself with the layout of the reference section. Unfortunately, as it is, intros rarely have these links or footnotes to the references, and I have to search for items specifically, losing out on the holistic view.

Re: Have you read your Python Docs Lately?

#10

I love python, I really do, and there is a library for everything you can imagine. So when I see things like this: c.most_common()[:-n:-1] # n least common elements For the love of ceiling_cat, how hard is it to implement a least_common method?

Well, that's pretty ugly anyway―what's wrong with: reversed(c.most_common()) Although I agree that a least_common function would be more "symmetrical" (don't ask me why c has one and not both), you can create it yourself (and have it not only readable but efficient !) in one line of code.

most_common(n) takes an optional argument, which makes a difference. With no arguments, you're just sorting the list, but when you just want the first N, you don't have to sort the entire list first. However, the partial-sorting optimizations are generally not symmetric, so supporting both most and least common would imply that either one direction is slower than the other, or the implementation is not as efficient as it could be for the case where only one direction is important. Only supporting most_common(n) makes it clear which case is optimized for.
Post reply on HN