September 17, 2004It's not about one-linersI have received quite a few comments on the previous entry so I thought I would clarify something. Jonas Galvez says:
The Python version is pretty much a one-liner too:
I don't care about the size of the code (I find that ten lines of Java are usually more readable that one line of Perl).
I do care about readability, which usually boils down to:
Comments
Cedric, you're right. I, too, think lambda is a bit of a line noise. And [::-1] is definitely obscure. But I somehow find it readable and clear enough, I mean, it's definitely not as obscure as some Perl idioms. Anyway, did you see my latest comment? Python has a built-in module called "glob" which allows you to retrieve a list of files using special parameters. The cleanest Python version would be something like (as I already posted before): files = glob.glob(".gz") Or, in Python 2.4: files = reversed(sorted(glob.glob(".gz"))) Posted by: Jonas Galvez at September 17, 2004 03:28 PMOps, that should glob.glob("*.gz"). By the way, I wrote a comment about Ruby but I keep getting a "Your comment could not be submitted due to questionable content" message. I've placed the content on a text file and uploaded it to my server: http://jonasgalvez.com/unsorted/about-ruby-20040917.txt Posted by: Jonas Galvez at September 17, 2004 03:34 PMI should add that I do realize this discussion is not about that specific operation of filtering files etc, but about the way properties/methods are accessed and how nicely it flows in Ruby. The portion of my comment that I placed in the .txt file (since it kept being rejected by the spam filtering system) summarizes my opinion on the subject :) Posted by: Jonas Galvez at September 17, 2004 03:44 PMYes, I agree readability is best, but I hear "life's better without braces". (remains to be seen, but I plan to see!) Posted by: Michael Levin at September 18, 2004 04:26 PMchqyivsw [URL=http://qjsjsgev.com]hqhyndtk[/URL] mzmoudqi http://qcgfpkyx.com brnsgmqu hsqsrsmz Posted by: qevdxmmi at May 28, 2007 08:42 PMPost a comment
|