Slashdot Mirror


2nd Edition of Learn Python the Hard Way Released

theodp writes "Are you or your kid intrigued by Python, but not quite ready to purchase an in-depth O'Reilly book? Zed A. Shaw's 2nd edition of Learn Python The Hard Way may be a friendlier option. Shaw's path to Python programming is simple: 1. Go through each exercise, 2. Type in each sample exactly, 3. Make it run. If $60 for the hardcover is too much to ask, or $15.99 for paperback, you can spend a measly buck for the PDF/ePub download. Still too steep? OK, there's even a free online HTML edition. After completing the 52 exercises, Shaw's concluding Advice From An Old Programmer says, 'Which programming language you learn and use doesn't matter. Do not get sucked into the religion surrounding programming languages as that will only blind you to their true purpose of being your tool for doing interesting things.'"

1 of 167 comments (clear)

  1. "Old programmer" here too, since 1982 by Anonymous Coward · · Score: 0, Troll

    And, for text processing? It's "up there" with the likes of PERL, because of RegExp... good stuff!

    * I co-wrote a system to obtain HOSTS file data with my nephew (from DNSBL lists, HOSTS files of others, & other data sources, including my own researches) in Python 2.7x to:

    ---

    1.) De-duplicate it/normalize said data

    2.) Alphabetize it

    3.) Convert the larger + slower 127.0.0.1 blocking IP Address of the "loopback adapter" address to the smaller + faster & most "universally compatible" 0.0.0.0 blocking IP address

    ---

    For HOSTS files... that's doing so, as I write this, & "automagically", via Python!

    Why?

    Well - I first used to do it circa 1997-2002 using Access Databases & a SELECT * DISTINCT ORDER BY query system after data import, & then export back to text file for the HOSTS file & yes... it worked, but, it didn't "nab" the data itself automatically & on timed intervals!

    So, about mid 2002, I later opted for a Borland Delphi system (because it's fast on strings), & @ the time? I used a "pure brute force" normalization route (slow on LARGE lists, but extremely fast on "smallish ones" (up to 1/2 million line iterms or so)).

    That's because in those days?

    Heh - That's when a 16,000 line HOSTS file for blocking out adbanners &/or known malicious sites/servers/hosts-domains was "huge"...

    Heh - I have, as of writing this & checking the tempfile my system uses before final commission back to the actual HOSTS file here, over 1,459,188++ entries in it... that telling anyone anything?

    Not nowadays though!

    Fact is, the malware-in-general & online attacks via bogusly scripted sites, botnets, & more problem got bad, and I can tell you this FOR A FACT from when my data started flooding in FAR FASTER than it used to, started around 2003-2004...

    I needed something BETTER on large data sets! I was contemplating rewriting the Delphi program algorithm to compensate (took 2 hrs. time on a Intel Core I7 920 CPU).

    See - Around the time I got to 750,000 entries though?

    The "brute force" deduplication algorithm I used in Delphi couldn't really "do the job" as well as it used to... was great & fast (tops 2-4 minutes on 1/2 million records IF I busted up the data into 48 parts, which the program had the options to do that IF I had lots of data) - this was a "temporary fix" though, vs. an algorithm that wasn't fitting the data set sizes anymore though!

    So, sure, I could have rewritten it, but Delphi isn't used as much as it used to be! Time to change...

    (BUT, in its day? In, of all places, a competing trade journal "VB Programmers Journal" Sept./Oct. 1997 issue, it KNOCKED THE CHOCOLATE out of both MSVC++ & VB5... by DOUBLE on MATH & STRINGS! Which is, why I used it of course - HOSTS are text data, & composed of strings!)

    So... what to do?

    Well, my nephew gets the idea to try my idea of HOSTS file processing (he's a junior @ RIT), & to do it in Python

    Guess what... it worked GREAT on this size file!

    The libs in Python have been written VERY well, lots of "DataStructures coursework" thinking went into their libs (written in C/C++ iirc)

    In fact it worked SO well, I decided to take what he had & extend it with errtrapping, better filtration, cleaning up some mistakes he made in filtration, adding console outputs, & better automation with parameter passing functions etc./et al!

    Hell of a LOT LESS WORK TOO, than Delphi or C/C++ code, even with their native string functions libs... which are good, but more work (Python turned up to be "VB-EZ" in fact!)

    So - I tried Python, for TEXT PROCESSING (when I was actually considering PERL first, actually) & have NOT looked back since!

    (Don't knock it, till you've tried it, & with every language, it tends to lend itself WELL, to certain things... for text & string proc