Why Python?

Cardinal Biggles had Eric in the comfy chair for over four hours before wringing this confession from him...
______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Good read

Anonymous's picture

As someone who just started with python, I found that it was much more verbose and time-consuming to write those short little programs and have some doubts about its efficacy and proclaimed 95% goodness RDI.

I guess now I feel more confident that it's not just me. Perl for short and quick, Python for things I'll be looking at again.

Good article

cmnorton's picture

This was helpful. Having programmed in PL/I, C, C++, Bliss, and other languages, the space indentation of Python initially put me off. I am starting to use it for small projects.

Something that helped me

Graphate's picture

this is what helped me out a little bit... if anyone really reads this anymore:
http://www.apple-group.com/forums/showthread.php?p=37923

2¢ out.

All the comments

Anonymous's picture

All the comments the author made about Perl seem to refer to Perl 4, and he seems to not have even the slightest clue about CPAN and the modern tools (Perl::Critic et al.) it offers to automate the enforcement of coding standards and best practices across a large developers team.

Ruby is worth a look. In

Anonymous's picture

Ruby is worth a look. In some ways, it is cleaner than Python (for example, lots of functions that should have been methods in Python are methods in Ruby).

My experience exactly

Eric Standlee's picture

After trying to do something in MSVB for two weeks, I was able to use python to accomplish it in 2 days from a cold start.

Don't use it all of the time, but love it.

python tutorial

Anonymous's picture

python tutorial on http://www.linuxenv.com

Just a couple Python questions

Ron Haines's picture

I am considering taking on one or two more languages for the purpose of creating public release applications. Having read your article "Why Python?", I must say it has certainly sparked my interest.
My questions are as follows...

Does python produce a compiled distributable program, or as one readers comment appeared to hint at, must an end user have "Python installed on there machine to run Python apps?

My main interests are programming languages that can produce compiled programs that can be used by the end user without the need of installing the programming language itself.

(Hmm.. did i word the right , hope so) In any case I will continue researching this and will probably discover the answer on my own very shortly, but answering this here could also help others with similar questions.

Thanks
=MANTA=

Interpreted

Anonymous's picture

Python is strictly an interpreted language. However, one can create a "frozen binary" which does create a standalone executable. py2exe, PyInstaller, and freeze are the three big ones, with former one being for Windows executables and the latter two being for UNIX and UNIX-like. This allows others to run Python executables without having it installed. However, it does not actually compile anything.

guten morgun

Anonymous's picture

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 Those who want to move the 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.

hi. can i install python on

Anonymous's picture

hi. can i install python on Windows XP? what version?

http://www.f1f7.net/vb/

Python is used by Windows XP

maskedfrog's picture

Python is included as a utility in XP.
It's already there :)
Came as quite a surprise to me at first.
However, seeing how useful a scripting language Python
is it really should come as no shock.
Details in implementing you own python scripts shouldn't be
too hard to find. Google can be a dear friend :^D

Python is not included on

Anonymous's picture

Python is not included on all XP Installations. HP and maybe a few other companies preload this on computers, because they have admin tools written in python. If you were to just buy XP, it would not already have it installed.

teach me

from malaysia's picture

hello..

anyone can teach me how to hacking..

pls..

are_raul92@yahoo.com

teh lol

Anonymous's picture

format c:\

lol

Anonymous's picture

format c:\
did not work as intended but I guess that is because linux isn't windows =)

i liked it

sohail's picture

is there any one who can teach me the basics of hacking

Reply to "Is there anyone who can teach basics of hacking"

Anonymous's picture

Email your ip address to me and I'll send you an email . :=)

Oh

Andrieux's picture

IP addresses mean nothing these days. You wouldn't be able to do anything with it, anyways.

"Email your ip address to me

Anonymous's picture

"Email your ip address to me and I'll send you an email . :=)"

Brilliant.

Thank you!

Anonymous's picture

Thank you for taking the time to write this informative and entertaining article. I very much enjoyed the natural flow of your writing style and, despite a lack of previous efforts to learn a programming language, you have persuaded me to give Python a try.
Nine years later and this article is still having an impact... now I'd say that should earn at least gold star for content!

Thank you!

pls i dont know basic

Anonymous's picture

hello pls i dnt know anything about hacking not even the basics i will b very gratefull if a prof will teach me my mail is ceiknw@yahoo.com

Quickest way to learn Python

Anonymous's picture

Dawson, M. “Python Programming for the absolute beginner” Latest edition. ISBN 1-59863-112-8

Seriously. Give it a try.

(Note: for BEGINNERS)

Best Python book for n00bs:

Anonymous's picture

Dawson, M. “Python Programming for the absolute beginner” ISBN 1-59863-112-8

Work though this, try all the examples and you'll be a l33t h@x0r in no time.

Disclaimer: I have nothing to do with the author or the publishers, just a happy customer.

learning in a few days

soundandfury's picture

So, esr is pretty stunned that he learned Python in a few days. Well, how about C? I went from knowing nothing but BASIC (in which I have been hacking for several years) to fairly good competence in C, in about a fortnight on and off. And I'm not in any way a wizardly hacker, I'm an adolescent who taught myself programming with BASIC.
So I think the moral of this is that /most/ programming languages are easy to learn if you've already learnt the practices in another language. Either that, or it's actually worthwhile spending longer than is considered normal in BASIC before going elsewhere.

In my first week I wrote a daemon to watch a network share and grab files from it to move somewhere else - configurable on the command line. In my second week, Newton-Raphson iterations (with functions stored as binary trees). I haven't tried Python, so I don't know how easy it is, but esr's description of how easy he found Python sounds a lot like my own experiences teaching myself C. Maybe C isn't as hard to use as esr suggests... OK, so neither of these were robust production-standard code, but they're not easy to break...

Learning the syntax of a

Anonymous's picture

Learning the syntax of a language and becoming an expert in a language are two different things.

Multiple Languages

Ron Haines's picture

Esr's opinion carried weight because the comparison is based on my not one or two languages.

As for finding it easier to learn multiple languages...
Yes, knowing many languages myself I would say that each language gets a little easier to pick up, but I am speaking from my own relative point of view of course.

My first language was like most, BASIC. Finding that too slow for video games and other graphics intensive use I went for the throat and learned 6502 and 6510 ML (Yes, I am dating myself LOL especially since I didn't get into programming until I was 30!), after that I learned ASM.

When the internet bloomed in the 90's I switched to HTML and scripted languages such as ASP and PHP, having mastered those I am now seeking out one or two modern compiled languages with which to write LINUX, WinOS desktop and I-Phone apps.

What I have found that makes subsequent languages easier to learn is the basic components all have in common such as Loops, Conditional Branches, Subroutines/Functions. Looking at them this way in my head (perhaps because of my experience in ML and ASM) I can quickly see relational functionality between almost every language I have learned so far. The tricky part for me seems to be keeping the syntax quirks for multiple languages straight in my head.

Since you are only on your second language I wanted share my thoughts on the similarities and add a suggestion (if you are truely hungry to master the machine) to try and learn at least one of the root languages ML or ASM. I realize that most poeple call them dead languages but I can promise you that even if you never write anything in them, one you have learned ML or ASM you will never see the way a computer thinks the same way again.

Benefits of knowing ML in a nut shell...

There is no such thing as copy protection.
Anything that can be written can be unwritten.
If you can envision it in your mind you can teach a computer to do it.

That doesn't mean I advocate cracking software, just that you will have the deepest understanding of how computers think and operate possible, and those principles and fundamentals will help you in whatever programming language you are using.

=MANTA=

ESR spoke as a veteran of multiple languages

Jonathan Hayward's picture

It may well be true that your second language is easier than your first, but ESR was astonished after studying [mumble] dozen languages and dabbling with Deep Magic.

If someone says, "My second language was so much easier," that's par for the course. If someone says "My twenty-fifth [or whatever] language is so much easier,"... maybe it really IS the language.

Written as someone who had studied a few languages, picked up Python... and thinks maybe it really IS the Python.

i like programming in python

anonymous's picture

i like programming in python but (and) the problem is when writing gui applications.is there anyone who can tell me the best gui package.And i started my programming in assembly and i don't know the qualities(the advantages of ) python on java or C please tell me about the differences.thank you very much

RE: Gui programming in python

victor miclovich's picture

Well, we have several GUI packages for python, although many are third party packages. They include, but aren't limited to this list below:
-wxpython
-tkinter
-qt
-PyQt (licensed for commercial purposes but free when used on open source projects)
-Swing (when using Python with Java classes... or Jython)

There are other numerous gui packages, like I said but others mostly are for other purposes usually scientific (modeling) such as Visual python....

I hope this could help :)
Vic

TO ALL THE POEPLE VISITING THIS PAGE ASKING HOW TO HACK...

Anonymous's picture

The guy who wrote this article (Eric S. Raymond) wrote a nice little essay that has everything you need to know: http://www.catb.org/~esr/faqs/hacker-howto.html

(and if you're under 25 you may have to look up the word "phreaking" in wikipedia, I did the first time I read that document)

tcp, database: python

tdb8's picture

one year ago i was (almost) new to linux (ubuntu), i knew no python, zero, at all.

my need was to store and retrive records to/from a database (any free one) depending on the tcp input stream both to display and store.

i needed it fast and to use immediately. one google search and python with apropriate library was on the firsts results.

Learning and implementing, one week in spare time.
the code could be prettier (not a programmer for years) but it works!

now, i didnt know about the easy interaction with graphics, and makes me willing to trash the terminal output and draw a nice window.

python for windows xp

Anonymous's picture

hi. can i install python on Windows XP? what version?

I got Python 3.0 installed

Toyman's picture

I got Python 3.0 installed in Windows XP.

Bad Bad Bad, if you have

Anonymous's picture

Bad Bad Bad, if you have python 3.0 or higher get rid of it. It does not work at all with any of the other python versions. It is not the same language as 2.x

Actually, for someone new to

Anonymous's picture

Actually, for someone new to the language, 3.0 is best as long as they don't need extensive libraries. On the whole, the syntax is much cleaner and the language itself is less redundant. Quit spreading FUD.

My problems (IMHOIMHOIMHO)

salmonix's picture

My problems (IMHOIMHOIMHO) with the writing is simply it is again a one sided Perl vs.Python article with some mistakings. First: I am not a great Perl hacker, but I can easily reread my 2000 lines of code - if one has difficulties with it, then should reconsider the style. It is true that you can write obscure lines in Perl - as you can use only idioms in speach that only native and local speakers can understand. But it is a different style to speak among friends (short dirty codes for yourself) and to the audience (clearly articulated code for others). Not understanding the difference is your shame.
Then: Python is easy to learn. For whom? Reading Python programming it really seems easy for me: nice legible classes, methods, easy to use documentation etc. But I am somewhat AFTER Perl. Simply witout knowing any programming language Python could also bring difficulties. It is impossible to judge how easy it is to learn Python once you know e.g.Perl. Then you can only judge if Python appeals you more or not. But do not confuse the terms. For me Ocaml is an interesting challenge and no shock at all. Is Ocaml easy to learn???? For I have the opposite feeling with C.
Python is a nice language with its one way to do it method, where problems of style is less a matter. But for some it is never appealing. Some state that programming is not art but engineering, but for some during programming sometimes the intuitive part of the brain (a helpful part) plays with the possibilities of style, leaving the rational part a bit of sleep, offering a different angle. As in life some people has style like a franchise hamburger, the same is with coding probably. Some people feel Python boring with annoying intendation and play with orcish or latin modules writing useless but fun code, and some people feel Perl confusing in change. As tools both languages are good tools with different emphasis. And being a Python fun I would not miss Perl. And vice versa.

Why Python?

wcdsugpy's picture

This article is timeless and timely. The former accurately portrays the yearning for the right tool to do the job. Sleepless nights and turning and tossing. The latter now prompts me to revisit a project put aside for the last 4 years. I encountered Perl at about the time that the article was written to process Excel files. I hated and do hate manual data entry and carve up scripts and makefiles to automate the task. Then the idea of a GUI came up and attempted to develop a GUI for the end users using the Win32 OLE Perl Module. And had a look at Perl/Tk but the program became increasingly lengthy and I had to put it aside. That's 2004.

Your piece on Pyhton objects for the fetchmail conf is inspirational and may be just what I need. I had looked at Python two years ago, documented my encounter but now will revisit it again.

For small jobs on data processing, Perl still shines but for bigger projects such as the one I have and another that was floated around in 2001, Python may be the right tool for it.

It will be an adventure.

Thank you

wcdsugpy@yahoo.com

Ruby

Leslie Viljoen's picture

Try Ruby though. Python is interesting, but Ruby is the proper replacement for Perl. I had to dump my Perl-childhood the day I found Ruby.

+1

Anonymous's picture

+1

Pathetic

Jonny's picture

Are all these comments just 11 year olds script kiddies trying to become "hackers"? Maybe they should research about what a hacker actually is before writing a very long and pointless manifesto.

Don't waste your time with cracking...If you enjoy it still, become an ethical hacker.

I find it quite pathetic in my eyes...

Language Programs

The next Crash Override's picture

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.

How to run a program

Anonymous's picture

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

Lumax's picture

When you are looking for Information about installing Python on Windows Vista, I found something here .... Hope that helps.

how to

Anonymous's picture

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.

Anonymous's picture

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.

THE Comment

epat's picture

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.

THE Comment - Corrections:

epat's picture

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

Anonymous's picture

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

Anonymous's picture

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?

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState