LWN.net Logo

Python Indentation Red Herring

Python Indentation Red Herring

Posted Oct 11, 2005 16:19 UTC (Tue) by carcassonne (guest, #31569)
In reply to: Python Indentation Red Herring by mkc
Parent article: Book Review: Perl Best Practices (NewsForge)

If this seems like the thing most bothersome to you about Python, why not "suspend this judgement for a while and give it a try? Speaking as a former Perl programmer, I don't regret doing so for a minute."

OK, sure. What's the Python equivalent to Memoization ?

Are there as much modules (or extensions or whatever) in Python that there is in Perl ?

The language is one thing. The libraries (or modules or extensions) provided with it are also very important. What would be Java without all the libraries ?


(Log in to post comments)

Memoization and Modules

Posted Oct 12, 2005 20:56 UTC (Wed) by AnswerGuy (subscriber, #1256) [Link]

Memoization is a programming technique (even an OO design pattern. The wikipedia article to which I've linked even shows a trivial Python implementation of a memoize function.

A more complete recipe for the technique can be found at the ActiveState ASPN Python Cookbook repository.

In response to the broader question about the availability of modules, extensions and code samples ... there are many. One could naively say that there aren't as many as for Perl. However I'm not sure that the comparison would be a wise one.

In general Python includes more in its base distribution/package. There are over 300 modules included; and the developers and maintainers carefully consider adding more with each release. The question should not be: "Are there as much [sic] modules ...?" The sensible question is: can the corpus of freely available code allow me to do as much and as easily as with Perl. It's a qualitative rather than quantified issue.

I won't render an opinion on the answer. That would be a endless debate. The best answer is for you to go to the Python web site, peruse the "Cheese Shop" (a.k.a. the Python Package Index, or PyPI) and perhaps pay particular attention to this wiki page to form your own opinion.

JimD

Memoization and Modules

Posted Oct 13, 2005 1:39 UTC (Thu) by carcassonne (guest, #31569) [Link]

"Memoization is a programming technique (even an OO design pattern."

Yes, but then it does not necessarily mean that it has to be written from scratch when needed. If needed and if available, why not use it instead of writing it ?

"The question should not be: "Are there as much [sic] modules ...?" The sensible question is: can the corpus of freely available code allow me to do as much and as easily as with Perl. It's a qualitative rather than quantified issue."

Well, even if 'corpus' is a singular word, it reflects in this context a quantity. And when there's quantity, there's choice.

About the quality aspect you mention in a way that seems to hint that on one side there's less but the quality is better, I dunno. I guess I stick with ample choice and amongst that choice, a whole bunch of tested modules.

Funny that on a thread about a new Perl book there are so many replies about Python and so many comments about where to place curly braces in Perl.

Anyhow, thanks for the URLs, I'll check them out.

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds