Have you read your Python Docs Lately?
jessenoller.com
Have you read your Python Docs Lately?
1–10 of 15 posts
Re: Have you read your Python Docs Lately?
#2 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?Re: Have you read your Python Docs Lately?
#3Easy 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?
#4Raymond 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?
#5I 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?
Re: Have you read your Python Docs Lately?
#6Re: Have you read your Python Docs Lately?
#7I 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?
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?
#8Raymond 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/
Fun with Python's Newer Tools: http://blip.tv/file/4883247
Re: Have you read your Python Docs Lately?
#9Re: Have you read your Python Docs Lately?
#10I 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.