Why Python?
May 1st, 2000 by Eric Raymond in
My first look at Python was an accident, and I didn't much like what I saw at the time. It was early 1997, and Mark Lutz's book Programming Python from O'Reilly & Associates had recently come out. O'Reilly books occasionally land on my doorstep, selected from among the new releases by some mysterious benefactor inside the organization using a random process I've given up trying to understand.
One of them was Programming Python. I found this somewhat interesting, as I collect computer languages. I know over two dozen general-purpose languages, write compilers and interpreters for fun, and have designed any number of special-purpose languages and markup formalisms myself. My most recently completed project, as I write this, is a special-purpose language called SNG for manipulating PNG (Portable Network Graphics) images. Interested readers can surf to the SNG home page at http://www.catb.org/~esr/sng/. I have also written implementations of several odd general-purpose languages on my Retrocomputing Museum page, http://www.catb.org/retro/.
I had already heard just enough about Python to know that it is what is nowadays called a “scripting language”, an interpretive language with its own built-in memory management and good facilities for calling and cooperating with other programs. So I dived into Programming Python with one question uppermost in my mind: what has this got that Perl does not?
Perl, of course, is the 800-pound gorilla of modern scripting languages. It has largely replaced shell as the scripting language of choice for system administrators, thanks partly to its comprehensive set of UNIX library and system calls, and partly to the huge collection of Perl modules built by a very active Perl community. The language is commonly estimated to be the CGI language behind about 85% of the “live” content on the Net. Larry Wall, its creator, is rightly considered one of the most important leaders in the Open Source community, and often ranks third behind Linus Torvalds and Richard Stallman in the current pantheon of hacker demigods.
At that time, I had used Perl for a number of small projects. I'd found it quite powerful, even if the syntax and some other aspects of the language seemed rather ad hoc and prone to bite one if not used with care. It seemed to me that Python would have quite a hill to climb as yet another scripting language, so as I read, I looked first for what seemed to set it apart from Perl.
I immediately tripped over the first odd feature of Python that everyone notices: the fact that whitespace (indentation) is actually significant in the language syntax. The language has no analog of the C and Perl brace syntax; instead, changes in indentation delimit statement groups. And, like most hackers on first realizing this fact, I recoiled in reflexive disgust.
I am just barely old enough to have programmed in batch FORTRAN for a few months back in the 1970s. Most hackers aren't these days, but somehow our culture seems to have retained a pretty accurate folk memory of how nasty those old-style fixed-field languages were. Indeed, the term “free format”, used back then to describe the newer style of token-oriented syntax in Pascal and C, has almost been forgotten; all languages have been designed that way for decades now. Or almost all, anyway. It's hard to blame anyone, on seeing this Python feature, for initially reacting as though they had unexpectedly stepped in a steaming pile of dinosaur dung.
That's certainly how I felt. I skimmed through the rest of the language description without much interest. I didn't see much else to recommend Python, except maybe that the syntax seemed rather cleaner than Perl's and the facilities for doing basic GUI elements like buttons and menus looked fairly good.
I put the book back on the shelf, making a mental note that I should code some kind of small GUI-centered project in Python sometime, just to make sure I really understood the language. But I didn't believe what I'd seen would ever compete effectively with Perl.
A lot of other things conspired to keep that note way down on my priority list for many months. The rest of 1997 was eventful for me; it was, among other things, the year I wrote and published the original version of “The Cathedral and the Bazaar”. But I did find time to write several Perl programs, including two of significant size and complexity. One of them, keeper, is the assistant still used to file incoming submissions at the Metalab software archive. It generates the web pages you see at metalab.unc.edu/pub/Linux/!INDEX.html. The other, anthologize, was used to automatically generate the PostScript for the sixth edition of Linux from the Linux Documentation Project's archive of HOWTOs. Both programs are available at Metalab.
Writing these programs left me progressively less satisfied with Perl. Larger project size seemed to magnify some of Perl's annoyances into serious, continuing problems. The syntax that had seemed merely eccentric at a hundred lines began to seem like a nigh-impenetrable hedge of thorns at a thousand. “More than one way to do it” lent flavor and expressiveness at a small scale, but made it significantly harder to maintain consistent style across a wider code base. And many of the features that were later patched into Perl to address the complexity-control needs of bigger programs (objects, lexical scoping, “use strict”, etc.) had a fragile, jerry-rigged feel about them.
These problems combined to make large volumes of Perl code seem unreasonably difficult to read and grasp as a whole after only a few days' absence. Also, I found I was spending more and more time wrestling with artifacts of the language rather than my application problems. And, most damning of all, the resulting code was ugly—this matters. Ugly programs are like ugly suspension bridges: they're much more liable to collapse than pretty ones, because the way humans (especially engineer-humans) perceive beauty is intimately related to our ability to process and understand complexity. A language that makes it hard to write elegant code makes it hard to write good code.
With a baseline of two dozen languages under my belt, I could detect all the telltale signs of a language design that had been pushed to the edge of its functional envelope. By mid-1997, I was thinking “there has to be a better way” and began casting about for a more elegant scripting language.
One course I did not consider was going back to C as a default language. The days when it made sense to do your own memory management in a new program are long over, outside of a few specialty areas like kernel hacking, scientific computing and 3-D graphics—places where you absolutely must get maximum speed and tight control of memory usage, because you need to push the hardware as hard as possible.
For most other situations, accepting the debugging overhead of buffer overruns, pointer-aliasing problems, malloc/free memory leaks and all the other associated ills is just crazy on today's machines. Far better to trade a few cycles and a few kilobytes of memory for the overhead of a scripting language's memory manager and economize on far more valuable human time. Indeed, the advantages of this strategy are precisely what has driven the explosive growth of Perl since the mid-1990s.
I flirted with Tcl, only to discover quickly that it scales up even more poorly than Perl. Old LISPer that I am, I also looked at various current dialects of Lisp and Scheme—but, as is historically usual for Lisp, lots of clever design was rendered almost useless by scanty or nonexistent documentation, incomplete access to POSIX/UNIX facilities, and a small but nevertheless deeply fragmented user community. Perl's popularity is not an accident; most of its competitors are either worse than Perl for large projects or somehow nowhere near as useful as their theoretically superior designs ought to make them.
My second look at Python was almost as accidental as my first. In October 1997, a series of questions on the fetchmail-friends mailing list made it clear that end users were having increasing trouble generating configuration files for my fetchmail utility. The file uses a simple, classically UNIX free-format syntax, but can become forbiddingly complicated when a user has POP3 and IMAP accounts at multiple sites. As an example, see Listing 1 for a somewhat simplified version of mine.
I decided to attack the problem by writing an end-user-friendly configuration editor, fetchmailconf. The design objective of fetchmailconf was clear: to completely hide the control file syntax behind a fashionable, ergonomically correct GUI interface replete with selection buttons, slider bars and fill-out forms.
The thought of implementing this in Perl did not thrill me. I had seen GUI code in Perl, and it was a spiky mixture of Perl and Tcl that looked even uglier than my own pure-Perl code. It was at this point I remembered the bit I had set more than six months earlier. This could be an opportunity to get some hands-on experience with Python.
Of course, this brought me face to face once again with Python's pons asinorum, the significance of whitespace. This time, however, I charged ahead and roughed out some code for a handful of sample GUI elements. Oddly enough, Python's use of whitespace stopped feeling unnatural after about twenty minutes. I just indented code, pretty much as I would have done in a C program anyway, and it worked.
That was my first surprise. My second came a couple of hours into the project, when I noticed (allowing for pauses needed to look up new features in Programming Python) I was generating working code nearly as fast as I could type. When I realized this, I was quite startled. An important measure of effort in coding is the frequency with which you write something that doesn't actually match your mental representation of the problem, and have to backtrack on realizing that what you just typed won't actually tell the language to do what you're thinking. An important measure of good language design is how rapidly the percentage of missteps of this kind falls as you gain experience with the language.
When you're writing working code nearly as fast as you can type and your misstep rate is near zero, it generally means you've achieved mastery of the language. But that didn't make sense, because it was still day one and I was regularly pausing to look up new language and library features!
This was my first clue that, in Python, I was actually dealing with an exceptionally good design. Most languages have so much friction and awkwardness built into their design that you learn most of their feature set long before your misstep rate drops anywhere near zero. Python was the first general-purpose language I'd ever used that reversed this process.
Not that it took me very long to learn the feature set. I wrote a working, usable fetchmailconf, with GUI, in six working days, of which perhaps the equivalent of two days were spent learning Python itself. This reflects another useful property of the language: it is compact--you can hold its entire feature set (and at least a concept index of its libraries) in your head. C is a famously compact language. Perl is notoriously not; one of the things the notion “There's more than one way to do it!” costs Perl is the possibility of compactness.
But my most dramatic moment of discovery lay ahead. My design had a problem: I could easily generate configuration files from the user's GUI actions, but editing them was a much harder problem. Or, rather, reading them into an editable form was a problem.
The parser for fetchmail's configuration file syntax is rather elaborate. It's actually written in YACC and Lex, two classic UNIX tools for generating language-parsing code in C. In order for fetchmailconf to be able to edit existing configuration files, I thought it would have to replicate that elaborate parser in Python. I was very reluctant to do this, partly because of the amount of work involved and partly because I wasn't sure how to ascertain that two parsers in two different languages accept the same. The last thing I needed was the extra labor of keeping the two parsers in synchronization as the configuration language evolved!
This problem stumped me for a while. Then I had an inspiration: I'd let fetchmailconf use fetchmail's own parser! I added a --configdump option to fetchmail that would parse .fetchmailrc and dump the result to standard output in the format of a Python initializer. For the file above, the result would look roughly like Listing 2 (to save space, some data not relevant to the example is omitted).
Python could then evaluate the fetchmail --configdump output and have the configuration available as the value of the variable “fetchmail”.
This wasn't quite the last step in the dance. What I really wanted wasn't just for fetchmailconf to have the existing configuration, but to turn it into a linked tree of live objects. There would be three kinds of objects in this tree: Configuration (the top-level object representing the entire configuration), Site (representing one of the sites to be polled) and User (representing user data attached to a site). The example file describes five site objects, each with one user object attached to it.
I had already designed and written the three object classes (that's what took four days, most of it spent getting the layout of the widgets just right). Each had a method that caused it to pop up a GUI edit panel to modify its instance data. My last remaining problem was somehow to transform the dead data in this Python initializer into live objects.
I considered writing code that would explicitly know about the structure of all three classes and use that knowledge to grovel through the initializer creating matching objects, but rejected that idea because new class members were likely to be added over time as the configuration language grew new features. If I wrote the object-creation code in the obvious way, it would be fragile and tend to fall out of sync when either the class definitions or the initializer structure changed.
What I really wanted was code that would analyze the shape and members of the initializer, query the class definitions themselves about their members, and then adjust itself to impedance-match the two sets.
This kind of thing is called metaclass hacking and is generally considered fearsomely esoteric—deep black magic. Most object-oriented languages don't support it at all; in those that do (Perl being one), it tends to be a complicated and fragile undertaking. I had been impressed by Python's low coefficient of friction so far, but here was a real test. How hard would I have to wrestle with the language to get it to do this? I knew from previous experience that the bout was likely to be painful, even assuming I won, but I dived into the book and read up on Python's metaclass facilities. The resulting function is shown in Listing 3, and the code that calls it is in Listing 4.
That doesn't look too bad for deep black magic, does it? Thirty-two lines, counting comments. Just from knowing what I've said about the class structure, the calling code is even readable. But the size of this code isn't the real shocker. Brace yourself: this code only took me about ninety minutes to write—and it worked correctly the first time I ran it.
To say I was astonished would have been positively wallowing in understatement. It's remarkable enough when implementations of simple techniques work exactly as expected the first time; but my first metaclass hack in a new language, six days from a cold standing start? Even if we stipulate that I am a fairly talented hacker, this is an amazing testament to Python's clarity and elegance of design.
There was simply no way I could have pulled off a coup like this in Perl, even with my vastly greater experience level in that language. It was at this point I realized I was probably leaving Perl behind.
This was my most dramatic Python moment. But, when all is said and done, it was just a clever hack. The long-term usefulness of a language comes not in its ability to support clever hacks, but from how well and how unobtrusively it supports the day-to-day work of programming. The day-to-day work of programming consists not of writing new programs, but mostly reading and modifying existing ones.
So the real punchline of the story is this: weeks and months after writing fetchmailconf, I could still read the fetchmailconf code and grok what it was doing without serious mental effort. And the true reason I no longer write Perl for anything but tiny projects is that was never true when I was writing large masses of Perl code. I fear the prospect of ever having to modify keeper or anthologize again—but fetchmailconf gives me no qualms at all.
Perl still has its uses. For tiny projects (100 lines or fewer) that involve a lot of text pattern matching, I am still more likely to tinker up a Perl-regexp-based solution than to reach for Python. For good recent examples of such things, see the timeseries and growthplot scripts in the fetchmail distribution. Actually, these are much like the things Perl did in its original role as a sort of combination awk/sed/grep/sh, before it had functions and direct access to the operating system API. For anything larger or more complex, I have come to prefer the subtle virtues of Python—and I think you will, too.
All listings referred to in this article are available by anonymous download in the file ftp.ssc.com/pub/lj/listings/issue73/3882.tgz.
Special Magazine Offer -- 2 Free Trial Issues!
Receive 2 free trial issues of Linux Journal as well as instant online access to current and past issues. There's NO RISK and NO OBLIGATION to buy. CLICK HERE for offer
Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.
Sorry, offer available in the US only. International orders, click here.
Subscribe now!
Recently Popular
| Linux HOWTO: Video Editing Magic with ffmpeg | Jul-23-08 |
| Google Gadgets for Linux | Jul-21-08 |
| Building a Call Center with LTSP and Soft Phones | Aug-25-05 |
| Man vs. Myth: Greg Kroah-Hartman and the Kernel Driver Project | Jul-21-08 |
| Boot with GRUB | May-01-01 |
| Review: HP 2133 Mini-Note | Jul-16-08 |
Featured Videos
Non-linear video editing tools are great, but they're not always the best tool for the job. This is where a powerful tool like ffmpeg becomes useful. This tutorial by Elliot Isaacson covers the basics of transcoding video, as well as more advanced tricks like creating animations, screen captures, and slow motion effects.
Shawn Powers reviews the HP Mini-Note portable computer.
Thanks to our sponsor: Silicon Mechanics
Silicon Mechanics is a leading manufacturer of rackmount servers, storage, and high performance computing hardware. The best warranty offerings available are backed by experts dedicated to customer satisfaction.
From the Magazine
August 2008, #172
There's nuttin like a Cool Project to give you some relief from the summer heat, so get out your parka cuz we got a bunch of em. First up is the BUG, not a bug, The BUG. It's got a GPS, camera and more, in a hand-sized package that's user programmable. The BUG does everything. It's both a floor wax and a dessert topping. Get one now. Need a software version of a Swiss Army knife? Take a look at Billix, and don't leave home without it. Then, chew on this one, an X server on a Gumstix device driving an E-Ink display. Need more storage? How about 16 Terabytes? Can do.
And, of course, we have the usual cast of characters: Marcel, Reuven, Dave, Kyle, Doc, plus the new kid on the block Shawn Powers. But it doesn't stop there: build a MythTV box on a budget, build your own GIS system, set up the tools to monitor your enterprise and more. Finally, remember The War of the Worlds? Now you can play too.

Delicious
Digg
Reddit
Newsvine
Technorati







Language Programs
On June 24th, 2008 The next Crash Override (not verified) says:
I really believe I could be a good addition to the hacker community because I read your how to become a hacker page at catb.org and I have the makings of a great hacker just don't know where to start so if you could hit me up at that e-mail address I would be forever grateful.
This is the Manifesto that I follow.
Another one got caught today, it's all over the papers. "Teenager Arrested in Computer Crime Scandal", "Hacker Arrested after Bank Tampering"...
Damn kids. They're all alike.
But did you, in your three-piece psychology and 1950's technobrain, ever take a look behind the eyes of the hacker? Did you ever wonder what made him tick, what forces shaped him, what may have molded him?
I am a hacker, enter my world...
Mine is a world that begins with school... I'm smarter than most of the other kids, this crap they teach us bores me...
Damn underachiever. They're all alike.
I'm in junior high or high school. I've listened to teachers explain for the fifteenth time how to reduce a fraction. I understand it. "No, Ms. Smith, I didn't show my work. I did it in my head..."
Damn kid. Probably copied it. They're all alike.
I made a discovery today. I found a computer. Wait a second, this is cool. It does what I want it to. If it makes a mistake, it's because I screwed it up. Not because it doesn't like me... Or feels threatened by me.. Or thinks I'm a smart ass.. Or doesn't like teaching and shouldn't be here...
Damn kid. All he does is play games. They're all alike.
And then it happened... a door opened to a world... rushing through the phone line like heroin through an addict's veins, an electronic pulse is sent out, a refuge from the day-to-day incompetencies is sought... a board is found. "This is it... this is where I belong..." I know everyone here... even if I've never met them, never talked to them, may never hear from them again... I know you all...
Damn kid. Tying up the phone line again. They're all alike...
You bet your ass we're all alike... we've been spoon-fed baby food at school when we hungered for steak... the bits of meat that you did let slip through were pre-chewed and tasteless. We've been dominated by sadists, or ignored by the apathetic. The few that had something to teach found us willing pupils, but those few are like drops of water in the desert.
This is our world now... the world of the electron and the switch, the beauty of the baud. We make use of a service already existing without paying for what could be dirt-cheap if it wasn't run by profiteering gluttons, and you call us criminals. We explore... and you call us criminals. We seek after knowledge... and you call us criminals. We exist without skin color, without nationality, without religious bias... and you call us criminals. You build atomic bombs, you wage wars, you murder, cheat, and lie to us and try to make us believe it's for our own good, yet we're the criminals.
Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.
I am a hacker, and this is my manifesto. You may stop this individual, but you can't stop us all... after all, we're all alike.
you need to actually learn a
On April 10th, 2008 Anonymous (not verified) says:
you need to actually learn a language to become a real hacker???sorry! dont have the damn time!so it is fun to become a hacker? it is fun as hell to hack into websites or forums(like my poor highschools forum)
Desperate to become a hacker
On June 13th, 2008 JonJon (not verified) says:
Hi hackers,
just need help. could u guide me where to get the PYTHON and whatevah u used for the hacking please....thank
Re: Learn Python
On June 9th, 2008 Makkus (not verified) says:
Well - you could start by learning a programming-language like python 8-) I found a nice site, that has some flash-tutorials. The site is called Sorn Computer (สอน คอมพิวเตอร์). Well I think we need more from this kind of free (!!!) tutorials on the net. Have a nice day.
Well, how else are you going
On April 22nd, 2008 Anonymous (not verified) says:
Well, how else are you going to develop your own toolset to research system security?
Hacking doesn't mean attacking and messing things up. That's cracking.
Hacking is to explore. It is to compromise, do nothing but leave a notice to the admin that something with their system isn't right. It is to develop tools and workarounds where manufacturers fail to address. There's actually some courtesy behind it.
Cracking is to cause others frustration and annoyance. Its about ego, profit, and fun at someone else's expense. It is selfish.
Hackers and Crackers generally have the same skill set. But its what they choose to do, is what defines them.
Hacker = White Hat = Ethical Hacker = Researcher = Good
Cracker = Black Hat = Bad
Learning to program is merely acquiring a skill set. Its what you do with it, that really counts.
Beginner needs help
On March 15th, 2008 CeLuciferwu73 says:
Hi~ I am new to the world of hacking. The only hacking i had ever done were in online games. My goal is to learn as much as i can, but i am not sure where i should start. If i am wrong please correct me. I think i should start by learing one of the computer language and found this article about phyton. However, i didn't really understand what the above was really saying. Can someone please help me.
ESR's How To Become A Hacker
On March 29th, 2008 MRH (not verified) says:
http://catb.org/~esr/faqs/hacker-howto.html
ESR's How To Become A Hacker
On March 29th, 2008 MRH (not verified) says:
http://catb.org/~esr/faqs/hacker-howto.html
My satellite tv for pc site
On July 16th, 2008 Phil Mathews (not verified) says:
My satellite tv for pc site was hacked about a month ago, and although it's really annoying I strangely think "well done, that's really clever"! I guess it's probably quite easy to hack in to most sites for an advanced hacker, but it amazes me how they figure out how to do it. Looks all too complicated, although I wouldn't mind reading up on python to "try" and figure out part of how hacking works.
Using Python without Guilt.
On January 23rd, 2008 Keith Olson (not verified) says:
It seems absurd for me to respond to an article almost eight years in the past (May 2000: "Why Python?"), but I note that the article is still eliciting responses, and that many of the charges leveled at Python are still being issued.
As a programmer more comfortable with "C" or Perl, I was initially repelled by the formatting requirement of Python.
However...Python "white space formatting" is not as rigid as I thought on first exposure.
[At least no more rigid than the '^#.*\n' syntax of sh, bash, or the "C" derivatives. I remember the religious arguments over /* ... */]
All of the variants of the simple example below execute correctly in Python.
>>> a=3
>>> b=4
>>> c=5
>>> if ((a in [1,2,3]) and (b in [4,5,6])) or (c in [5,6,7]):
... print 'y'
...
y
>>> if ((a in [1,2,3]) and (b in [4,5,6])) or (c in [5,6,7]): print 'y'
...
y
>>> if ((a in [1,2,3]) and (b in [4,5,6])) \
... or (c in [5,6,7]): print 'y'
...
y
>>> if (
... (a in [1,2,3]) and (b in [4,5,6])
... or
... (c in [5,6,7])):
... print 'y'
...
y
>>>
Formatting in Python is no more constrained than any modern language.
In any event, I am an Eric S. Raymond fan. I enjoyed the article.
Hey, is there some way to
On January 15th, 2008 Anonymous (not verified) says:
Hey, is there some way to know who is the owner of a computer?
Is that someone's insulting me all the time
and I wanna know who he or she is.
I have he/her IP. I jst want to know who he/she is.
Yes, you have to use an
On January 22nd, 2008 Anonymous (not verified) says:
Yes, you have to use an adjunct induction regulator to find that computer's protocol subclause. Then you initiate an auxiliary targetted RWG attack to find the owner's username.
help me
On April 28th, 2008 Anonymous (not verified) says:
4. Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version:
| 1 2 3 4
----+--------------------
1 | 1 2 3 4
2 | 2 4 6 8
3 | 3 6 9 12
4 | 4 8 12 16
Awesome, thank you so much -
On February 20th, 2008 Anonymous (not verified) says:
Awesome, thank you so much - it worked perfectly!
Can you teach me?
On March 15th, 2008 CeLuciferwu73 says:
Hi~ I would like to learn how to do that, but i have no clue what to do because i am new to the hacking world. I would be very greatful if you can.
In German there's a saying
On March 24th, 2008 Anonymous (not verified) says:
In German there's a saying for situations like this: "Herr, wirf Hirn vom Himmel!" (Lord, throw brain from the heavens!). You might also wanna try posting to a place that actually has some relevance to your question. You don't ask your car mechanic to fix your fridge do you?
Very useful article though, cheers
help me
On January 14th, 2008 Anonymous (not verified) says:
i need to learn how to hack into websites can you please help me!
I know a group of people that know all about this...
On April 15th, 2008 Anonymous (not verified) says:
Here is their website:
https://tips.fbi.gov/
just fill in your information, and they will promptly answer any questions about cracking into computers...
Awesome article
On April 1st, 2008 Anonymous (not verified) says:
And I thought I had problems!
Awesome article BTW!
you just cant. forget about it
On February 18th, 2008 Anonymous (not verified) says:
you just cant. forget about it
How to run a program
On December 6th, 2007 Anonymous (not verified) says:
Ok, so I downloaded Python, the newest version 2.5. And I have some writing experiance (I took a C++ class in highschool) and heard that this is a good language to start on. Anyway the C++ I used had a compiler, and i have no idea how to get my script to run on Python. Uhmm, you may also know that I''m running it on a laptop, Windows Vista. So thanks in advance for any help!
Install python on Vista
On December 18th, 2007 Lumax (not verified) says:
When you are looking for Information about installing Python on Windows Vista, I found something here .... Hope that helps.
how to
On September 29th, 2007 Anonymous (not verified) says:
i recently recieved a dell inspirion 1501 with amd64x2 and, for some reason, it refuses to let me download python. any suggestions?
You don't say what OS.
On October 16th, 2007 Anonymous (not verified) says:
You don't say what OS. If you're running Vista you need a .dll from the XP Win folder.
Vista w/Python: http://python-forum.org/py/viewtopic.php?=&p=12964
Since you run an AMD64, the Win thing to do, for Python, is 32-bit emulation. If you're running Linux, you've already got Python in 64-bit living color.
Please help me!!
On July 10th, 2007 Anonymous (not verified) says:
Guys please help, i recently had a summer ball and the girl of my dreams dress fell down as the photgrapher took a shot. he refuses to send it, but i want it so bad.lol. is there a way to hack a business comp externally??? help me out guys!!!!!!!!!!
That's cracking idiot, not
On December 17th, 2007 {TCC} SLT (not verified) says:
That's cracking idiot, not hacking. You can view exactly what Eric Raymont thinks about that here
Wow ... you should really
On December 5th, 2007 Anonymous (not verified) says:
Wow ... you should really get a life.
Word Processor
On June 10th, 2007 Anonymous (not verified) says:
How can i install a word processor with phython. I want to install KWord but I dont know how to install with the python dvd. btw why do they not package koffice with python.
Re: Word Processor in Python
On January 11th, 2008 Anonymous (not verified) says:
Greetings. When you are looking for information on text-processing in python, you should have a look here.
They offer information and a link to a free e-book for learning how to program "Text Processing in Python". Well, that should be enough for the beginning. Hope that helps.
Re: Word Processor
On September 16th, 2007 Calorie-Dude (not verified) says:
If you just want a few features, use wordpad (start it by typing
write in a dos box, or use menu start>programs>accessories>wordpad) to make yourself
a template file and save it as .rtf. You can use %(placename)s in the text of the
template, so you can plug in substitution text using a dict, e.g.,
template % {'placename':'replacement text', 'anotherplace':'etc'}
Re: Word Processor
On August 23rd, 2007 Thai Marco (not verified) says:
Installation is straightforward. Simply go to the fink Web site (http://www.fink.sourceforge.net) and download the current version (0.6.2). You install it like any other application. The major difference in how it installs is that it creates a new directory, /sw. Fink will then install any fink applications into this directory, so if you decide that fink isn’t for you all that you need to do is delete the /sw directory and it’s gone.
I spy a spammer hit!
On April 29th, 2007 Penguin Pete (not verified) says:
Off the subject (but standard Huzzahs to ESR and Python anyway!) but I see a number of recent comments show hits from what I've come to call "the alphabet soup spammer". The pattern is identical: random 8-letter strings for everything, link doesn't even go to a real site. The prevailing wisdom so far is this is some kind of attempt at Bayesian filter-jamming. I'll bet your sysadmin has noted that the logs show the spams coming from IP addresses all over the world, only one or two per day.
FYI, I finally kicked these off my own site by using an algorithm that counts the letters in each string in the comment post, and if it finds mod(count, 8)==0, that's one flag. Then it compares letter frequency with ETAOIN SHRDLU, the pattern for the letter-frequency order of normal English, and raises another flag if it's a grossly poor match. rather like Slashdot's jibberish filter. And I had to do it in PHP! (ugh!)
I'm interested in sharing and learning more information for a better method of screening this joker out. As it stands, I worry that legitimate comments with poor typing skills and unlucky word choice are getting unjustly screened out.
Native English
On April 26th, 2007 Dis3ase (not verified) says:
Just wanted to throw you some respect. Nice article and I appreciate the time you've dedicated to the cause.
-Rob
|_|*|_|
|_|_|*|
|*|*|*|
well done
On April 7th, 2007 symantec (not verified) says:
i really love python and honor your great knowledge eric, i allways enjoy reading your stuff. thank you for the good work!
symantec
On July 14th, 2007 damenwäscheträger (not verified) says:
i agree with you, excellent reading fantastic resources. nothing more to say. just a little bit more: for me its to much spamhere please delete all that sh.i thank you
Whats comming next
On March 26th, 2007 Marlies Meyer (not verified) says:
Hi Eric,
well written article. I never understand the advantages of Python but know i realise some specials that i never thinked about. is there some more ressource ou there that have u written? i would be nice to read some more. thank you and god bless you.
Marlies
Oldie but Goldie
On March 25th, 2007 Dan Larkin (not verified) says:
Your Article Eric is pretty old (2000 is in the age of Internet really really old :-) but still up2date. i found it just like you as an accident but i`m impressed what and how u wrote and that over 7 years ago, damned thats pretty good. at time i just wrote things with php and mysql but your article gave me some usefull hints so i decided to go deeper in the hole phyton-thing. thank you for your usefull informations.
best wishes from germany
Dan
wow!
On March 21st, 2007 Anonymous (not verified) says:
cool stuff.
really usefull eric..:]
HELP ME!!!!!!!!!!!!!
On August 16th, 2007 AJD0701 (not verified) says:
There is nothing else in the world that i'd rather be than an HACKER PLEASE PLEASE HELP ME MY E:MAIL IS dillydarby@hotmail.co.uk
to be hacker
On September 17th, 2007 Anonymous (not verified) says:
is good to be a hacker
DETERMINED TO LEARN 2 /HACK.
On November 13th, 2007 Anonymous (not verified) says:
Listen i need some one to teach me how to hack and ur comment said "to be a hacker" im willing to learn everything you can teach me,cuz i wanna be able to hack into schools and businesses and all that good shit or atleast some basic hacks....... like to create my own devestating viruses
Creating "devestating [sic]
On January 9th, 2008 Anonymous (not verified) says:
Creating "devestating [sic] viruses" and breaking into systems is not hacking. Did you read the article? No? Not even one bit of it? This is about writing a GUI to a mail-managing program. What you're asking to do is cracking, which is stupid and is good for nothing but an adrenaline rush and, depending on what you're cracking, a free admission to prison. To help you with your confusion, here are two pages on Eric Raymond's website (he's the author of this article).
Definition of cracker
A story about a hacker's response to someone asking how to "b3 a wizard hax0r and 0wn ever3one's b0xen."
hey i hope you got some help
On November 30th, 2007 Anonymous (not verified) says:
hey i hope you got some help i want to be a hacker too would you give me an advice.
really good!
On March 12th, 2007 Miriam (not verified) says:
i never understand the advantages of phyton but with this article of eric i think i`m on the right way. it seems the language is much more powerful than i thought so i desided to learn more of it. this article is a really good startpoint with much informations i hope in the future are coming more of that. thank u very much.
I wanted to learn this
On March 17th, 2007 Marco Basali (not verified) says:
I wanted to learn this language sooooo long before. It is free, it is distributed on various Linux-Distri`s - but the point is - that I can handle everything with my lovely PHP. Can somebody give a short example, why I have to learn Phyton. Thanks.
THE Comment
On February 14th, 2007 epat (not verified) says:
Basically - There are four types of people commenting on this:
1) Perl Zealots
2) Python Zealots
3) Wannabe Hackers (Wannabe Coders - to avoid confusion)
4) Wannabe Crackers.
First of all - for (1) and (2):
--------------------------------
Unless you program in both langauges fluently you shouldn't really be comparing readablility and certainly not flaming either of them.
I don't know perl so I am not going to compare the specifics in either langauge; but what I can tell you is that most large perl programs I have used on linux have had a LOT of bugs in them (and believe me when I say I am VERY good at finding bugs) so far, I don't think ANY perl program or script has lasted more than 5 minutes of me tweaking options before it has crashed and forced me to try and debug it. On the contrary, most python programs and scripts I have used do NOT crash within 5 minutes and even the badly written ones usually last me around about 10 minutes before I find something that breaks the program. Those are just from a users perspective although I admit that I am probably going to be slightly biased perhaps and maybe the more robust python programs are just dependent on what they are used for.
The other difference between perl and python from a user perspective is the speed. perl FEELS slower than python - feel free to prove me wrong on this one though - if you can - but don't bother unless you can either program both fluently as said or you get the statistics off of another source which is UNBIASED.
No comment on perl here - but in general, I have found python to be a lot more readable than any of the natural based langauges I have ever tried to read or code in simply BECAUSE of the strict formatting and coding style which in fact only really has ONE rule - that any line ending with a ':' requires the next line at least to be indented with a 'TAB' for it to work correctly.
For (3):
---------
If you are wanting to learn a langauge to use it for something productive like creating useful file convertors and especially for programs with a nice GUI - in fact, for ANYTHING user orientated. I thoughroughly recommend python since it is VERY easy to pick up (I mean it - it took me about 2 days to know almost all of it without even touching a 'users guide' or 'reference manual' but just by reading other peoples source code and trying to modify it to fullfil my own needs) and is also quick, makes nice GUI's and above all, you won't spend ages debugging your code. It is also self documented in almost all places and although lots of people don't realize it, documentation for a specific class or function - in fact, just about anything - can be found by just doing something as simple as:
print(..__doc__)
and a list of functions, variables and classes etc in a module can be found simply with:
print(dir())
If you scour the net for long enough you are almost gauranteed to find a script that provides an interface to browse these listings and documentation strings (I started with one and modified it over time to browse dictionaries and auto create classes dynamically as well as load modules dynamically depending on what was typed in to the browse module input widget).
This also demonstrates pythons power - one of the main reasons for using python above any other langauge is the ability to write very robust dynamic applications with it - so far, I have NEVER coded a single hard limit into ANY of my programs because in all of them, I was able to design simple code that did the same thing dynamically and was only limited by the users hardware or screen resolution etc... (it is also easy to code detection procudures into python scripts and programs so that options which would strain the hardware and/or crash the program are not displayed - e.g. a graphics detection system in a 3D game which stops the user from selecting options that would compromise stability if his hardware doesn't support it).
My advice to you is to go and get some python programs or scripts from somewhere and modify them by copying bits of code and/or looking at how somebody else does something in a different script and then reprogramming it to fullfil your requirements instead.
A good place to start would be a template script which initailizes a GUI and/or data structure(s) for you to extend on!
Having said all that, if you are a website designer and administrator then perl may be a better choice for you - if you like writing freestyle code that only you can understand and use that is - and if you are quite happy to create a new script for every problem you encounter rather than just modifiying old ones to better suit their purposes. As long as you are not writing code for end users but instead for computers to read and parse later automatically without even involving the user then perl is a viable choice. In fact, this is what perl is most useful for - automated scripts that ask few or no questions but that just run and execute providing a result at the end. Anything that involves user interaction however is not so well suited because the user will inevitably introduce errors into your (supposedly) well thought out program execution order and perl is not very good at catching and/or fixing these issues when they arise.
For (4):
---------
What you want to do is basically illeagal and a complete waste of time. If you like breaking into things and testing security, go and get a job as a website security adminisrator or something and put your skills to good use instead of giving yourself a boost by breaking into other peoples websites for fun. If you would like to get a job as a site admin but haven't yet got the skills then go off this forum (which is mainly coders and REAL hackers) and find yourself a crackers site to post questions on. Better still, actually go and speak to a security admin and ask them about cracking. Then you will not only learn HOW it works but will also come to appeciate just how much work goes into keeping websites and the likes secure and perhaps you will realize that maintaining security is just as challenging and as difficult (some would say more so) as destroying it and that persuing security maintenance is in fact, the better option and you even get paid for doing it!...
Addendum:
----------
I spent quite a while typing this and I hope it keeps some people quiet who don't seem to want to live with their differences and also clears up some things as well. If I have offended anybody in any way however, don't bother picking my post apart and blasting it back to me in flaming pieces because I won't reply anyway as I have already spent too much time commenting. Still, for those of you who have been having flame wars over programming langauges, thank you very much, you made my day and you also gave me the incentive to write this after amusing myself by reading through all your very heated comments (some of which are quite funny! ;)
-epat.
Hmmm... whom am I?
On November 12th, 2007 vacuum cleaners (not verified) says:
I probably fall into the wannabe categories. I've heard a lot about python, and found this post very interesting. The fact that white space can mean something in this language (as per the write-up) is fantastic to me. That's a really interesting idea. But it must be incredibly frustrating to keep things clean that way. Categorizing and all of that kind of thing must be excessively difficult. I wonder why they did this – other than just to be cool, perhaps. It must be interesting using this for the first time. I'm keen to try it out sometime very soon.
THE Comment - Corrections:
On February 14th, 2007 epat (not verified) says:
The two lines of python code I gave came out a bit wrong because of pesky html trying to understand them - here are re-formatted versions:
print([module name].[class/function name].__doc__)
and:
print(dir([module/class name]))
-epat. :)
Basing a point on which
On February 18th, 2007 Anonymous (not verified) says:
Basing a point on which language is superior on the quality of code programmers write proves you have a bit more programming to do in life. If you are so proficient in finding bugs in perl applications, why dont you go out and find a bug in amazon.com and have it "crash"...
Basing a point on which
On May 28th, 2007 Anonymous (not verified) says:
Basing a point on which language is superior on the quality of code programmers write proves you have a bit more programming to do in life. If you are so proficient in finding bugs in perl applications, why dont you go out and find a bug in amazon.com and have it "crash"...
That would be hard since amazon.com isn't in perl, eh?