I had a rather strange experience this morning. There's been some talk of publishing Data Munging with Python which would contain my words but with the Perl code replaced with Python. Currently we have a Python programmer who is producing some sample chapters and this morning he sent me a draft of one of the chapters.
It was very weird reading my own words but seeing someone else's code in a language that I don't really understand.
Maybe I'll pick up a bit of Python from this project and, hey, if I can say I'm co-author on a book about Python then that can't hurt the CV :)
Re:Data munging with ...
nicholas on 2003-05-16T09:07:16
(Caveat - I have not read Dave's book, so I don't know exactly what is in it.) "core" C (c.f. "core" perl) would be hard, as I think that to do it properly you'd have to re-implement Perl's data structures in C. However, I don't know if any freely available C libraries give you enough to avoid that step, and hence make writing data munging with foolib viable.
However, rather than pure "Data munging with Python" what I'd really like to see is "Data munging with Perl/Python/Ruby/TCL" (say) where there are equivalent code examples in all 4 (or 3? too many?) languages, so that you can directly see how they map to each other. For that matter, "Data munging in Perl6" could also be quite informative.
Re:Data munging with ...
dlc on 2003-05-16T12:56:50
However, rather than pure "Data munging with Python" what I'd really like to see is "Data munging with Perl/Python/Ruby/TCL" (say) where there are equivalent code examples in all 4 (or 3? too many?) languages, so that you can directly see how they map to each other. For that matter, "Data munging in Perl6" could also be quite informative.Amen!
I've been waiting for a while to see a book that intelligently presents (and possibly compares) the same technique in several languages, and since text munging is such a common task, this would be a good example.
It would also, incidentally, highlight how optimized Perl is for the task, compared to other languages.
There are equivalent command structures in both languages, but would just translating code segments cut it, really ? Some of the most useful things I learnt from the book are specific to Perl.. (fiddling with the record separator variable, for example)
Then again, (this is because I dont know any better
Re:How would this work ?
dlc on 2003-05-16T13:01:42
does Python have an equivalent to Parse::RecDescent ?Not as such. There are several parser building libraries available, but none of them have the breadth and scope of Parse::RecDescent.
This is, I think, because the Python community doesn't have a specifically-retained Mad Scientist. The language can definitely natively support a Parse::RecDescent-type module (as opposed to C, like Nicholas points out), though.
Re:How would this work ?
chaoticset on 2003-05-16T18:46:36
Here's an awful thought -- the same person could convert Parse::RecDescent to Python. Tell them it's extra credit.:D
You could do a lot worse than pick up some Python -- it's a nice language, with a lot going for it. And, for as much as we in Perl community like to complain about it, it's a lot more similar to Perl than many other languages that we don't complain about (it's just an easier target that many other languages).
I meant to mention this earlier. David Mertz is writing a similar book, called Text Processing In Python, which looks like it will be pretty good.
<heckle>The full contents of the book are available on his site.</heckle>