Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

davorg (18)

davorg
  dave@dave.org.uk
http://dave.org.uk/
Yahoo! ID: daveorguk (Add User, Send Message)

Hacker, author, trainer

Technorati Profile [technorati.com]

Journal of davorg (18)

Friday May 16, 2003
02:59 AM

Data Munging with Python

[ #12237 ]

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 :)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • C, please! No, really. I'd find that dead useful.
    • (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.

      • 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 su

        --
        (darren)
  • 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 :) ), does Python have an equivalent to Parse::RecDescent ? (there is one chapter worth of material on that module alone)

    • 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.

      --
      (darren)
  • 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).

    --
    (darren)
  • I meant to mention this earlier. David Mertz is writing a similar book, called Text Processing In Python [gnosis.cx], which looks like it will be pretty good.

    <heckle>The full contents of the book are available on his site.</heckle>

    --
    (darren)