Guido van Rossum Interviewed
Qa1 writes "Guido von Rossum, creator of Python, was recently interviewed by the folks at O'Reilly Network.
In this interview he discusses his view of the future of Python and the Open Source community and programming languages in general. Some more personal stuff is also mentioned, like his recent job change (including the Slashdot story about it) and a little about how he manages to fit developing Python into his busy schedule."
I want to learn python, where should I start? I have looked at it breifly before, but now I actually have time to learn it. Any good pointers?
That's what says in the link to the Python tutorial. It's quite good to get you to know the language and does not require a lot of previous programming experience. Then, the library reference can come very handy too.
-- Repeat with me: "There is no right to profits".
explain what the major advantages of using Python are. I have only ever looked at it very briefly and even more briefly at Jython. From this very limited experience I cant really think of a compelling reason to use Python over some of the more mainstream languages, other than perhaps as a scripting type glue.
Do not try to read the dupe, thats impossible. Instead, only try to realize the truth
What truth?
There is no dupe
Sure you can do the same things in other languages, at the end all general languages are Turing Machine equivalent. The difference is that Python is EASY to read (according to Master Yoda). It is bottom-up designed to be.
So it is good not only for scripting, but too for prototyping and for everything which needs to be flexible and not too much efficiency-critical. The logic of some videogames is encoded in Python, you know.
Singularity: a belief in the "God" idea with the "demiurge" relation inverted.
Interviewer: Why did you make whitespace significant in Python?
Guido: I smoked a lot of crack that day.
I think Python has a very bright future. For many purposes, it obsoletes Java. Java is more widespread than Python now, but it's proprietary and suffers from a historically slow GUI.
Many people use Python for tasks they used to do in Perl, but I don't see Python replacing Perl. They serve different purposes, for the most part.
Ruby is also an interesting language, although I don't personally know much about it, except that it aims to be truly OO. Again, slightly different purposes, but I don't think Ruby will ever be very widespread.
Any real geek knows that a language that isn't self-extensible through its macro system (ala Lisp, Scheme, Dylan) is just plane lame. :-)
I haven't been following python for a long time, though I've used it for a few projects. I know a lot of Lisp-like features such as lambda, eval, etc. have been added to it. (Java's adding a *lot* of features that Dylan has had since its inception, such as keyword arguments... but adding those features to Java makes the language even more ugly.) But what about a real macro system (and I don't mean a C style macro system)? I assume that it would be difficult to incorporate into Python because the Python syntax is not as consistent as the Lisp-family languages.
I assume that Python is still not efficiently compilable either, right? I think Guido was discussing a sealing mechanism for Python similar to Dylan's. Gywdion Dylan can produce code that's as fast as code written in C... and there's still many more optimizations that can be implemented into the compiler.
As a CS major, the intro CS classes at my school recently switched from teaching Java to Python. The class is designed to teach the fundamentals of computer science and computer pogramming. Python is extremely easy to learn, and quite powerful. We used the free text How to Think Like a Computer Scientist as the course textbook. I recommend this text to anyone interested in learning Python as a first programming language.
1) Indentation instead of bracing. Yes, I know some people hate it but for me it makes the structure so clear.
2) Object orientation. I did OO with C++. I actually understood it with Python.
3) The smoothest ever integration to low level languages like C. Gotta love it.
4) Easy to learn. Write ab initio code with C/Fortran and never-programmed-before people interface it with Python. Then, grind out those MSc and PhD theses...
Very interesting interview. I've had many conversations with experienced programmers and with people who'd barely could program a Hello World in Python. After discussions we allways came out with Python to be the best language to learn to the newbies. It's nice, clean, dynamic-typed, which I find an important thing for someone new to programming, cause it lets you focus on the WHOLE thing and not on minor details (eg. details).
I've been a Python user myself and I find it quite remarkable how it has evolved since its 1.5.2 to the pointer where they are now 2.3. More and more (interesting) software is being written for it. But evenly important is the code base of Python. It's C implementation is very clean written and very easy to use so one can write extension modules very fast.
Alan Perlis once said: "A language that doesn't affect the way you think about programming, is not worth knowing"
ORN: This resonates with your long-held interests in "computer programming for everyone". Don't you think that perhaps "everyone" is too broad, and that there aren't at least some people who will never be capable programming a computer?
GvR: That's a deep philosophical question. I'm optimistic about that in theory.
[...]
Given that I believe everybody can learn to read and write, given the right education and circumstances--obviously if your parents have no money and you're sent to work when you're seven years old, you're not in a very good situation unless you're exceptionally smart--I believe that the same thing would be possible for programming and thinking logically to some extent.
Singularity: a belief in the "God" idea with the "demiurge" relation inverted.
Python is available for the regular Zuarus OS as well.
Just because you're paranoid does not mean that the world is not full of assholes.
My recomendation:
Python in a Nutshell by Alex Martelli
Hands dow the best introduction to Python from a programmer's prespective. That is if you are already familiar with basic programming concepts. The great thing about the book is that covers just about every aspect in an extremely concise way that does not bore you to death.
I'm a certified Java and XML developer, gave up on Perl long time ago, discovered Python, somehow got over my initial suspicions regarding the whitespace ... within two weeks it became my favorite language. I do just about everything in Python and it takes about 80% less effort. Love it baby!
Quote of the week from the python newsgroup:
"What can I do with Python that I can't do with C#?
You can go home on time at the end of the day." -- Daniel Klein
h
There's a fairly detailed interview with bruce eckel ("famous" guy who has written c++ and java books and sits on the C++ standards committee) at artima on why he likes python (I linked to the last part of the article series, since that contains links to the previous ones).
Python already works on 64-bit systems.
Java is almost never interpreted these days. Its loaded as virtual machine byte code, then dynamically profiles, optimized and run as high-performance native code in almost all situations. High quality VMs (such as those from IBM) can run many Java apps as fast as C/C++. Saying that perl/python and other scripting languages beat Java in terms of speed is simply typical Slashdot anti-java FUD.
You don't have to do any kind of language design when you do Lisp programming. You can get a long way with just using plain function definitions. Yet you can easily define new syntaxes, control structures and stuff.
Back when I was the proud owner of a Commodore C 128, I used to think similar things about useless stuff like GOSUB. Why can't we just stay with the more familiar GOTO that everyone understands?Get over it. Learning new tools is usefull, but it's work. Get a good book on Lisp macros, and dive in.
You are not alone. And, given that you can actually define a new syntax, many people tried to come up with alternatives to raw s-expressions. And indeed succeeded. However, none of these alternatives ever got too popular (the most successfull attempt might by the Dylan language, which started with s-expressions, but dropped them). People could have used alternative syntaxes, but the vast majority chose not to.Programming can be fun again. Film at 11.
It's a great reference. I taught myself quite a bit of Python from scratch using only that "book". Very clear, and very comprehensive. The fact that it's free, and downloadable in a variety of forms, just makes it even better.
Surnames starting with "Van" ("from") are Dutch, like Guido.
"Von" is the German version. Dutch people don't like to be taken for Germans, for historical reasons..
GvR: ...I do it myself by staying where I am and giving keynotes at conferences and making my personal life the subject of discussions on Slashdot. ...
ORN: Perhaps they should get lives of their own instead of discussing yours?
I think he's talking about us...Also, this is just a nit pick but, while I realize that Python is a big subject, I dislike how often this book mentions something only to conclude "but I don't cover that here." Why tell me what you're not going to tell me? Just tell me what you are going to tell me. I can do the 'subtraction' myself.
Personally, I have found that the best way for me to begin learning Python and to continue to learn Python is to check out the documentation, google for specific questions, and experiment for the rest. Experimenting is especially handy and productive given the Python interactive interpreter (especially when coupled with the bash shell history). While there may be other languages/interpreters which allow you to do so, Python is the only language/interpreter I know of which allows you to design GUIs on the fly, adding and configuring elements from the command line: Which brings up another point. I have yet to find a really good source for Tkinter info -- neither a good tutorial nor a good reference. My main source of info to date is to use the following tricks. If, for instance, I want to find what I can do with the button in the example above, I do this. I would greatly appreciate it if someone could point me to a quality Tkinter reference.
PHP suffers readability not in syntax, but in archetecure design. With global namespaces for module functions (say, for example, to FTP a file), you do not have the ability to trace the logic between source files and modules in someone else's code. In addition, PHP encourages the inlining of code in presentation, and most PHP code is not modular (some is) - but on top of that the most popular mechanism for code reuse is eval() and include(), which simply pop more crap into the global namespace without being explicit what they do.
All this impacts readability. Python does not have these problems becuase it encourages explicit namespaces for all objects/modules/packages/classes/etc. Python also enforces readabilty by simple (easy) use of whitespace (this is a good thing.
PHP is popular (as is M$ ASP) becuase it has a gentle slope for web designers to learn programming. I don't think this is a bad thing, but inlining code and presentation is really not the right way to be encouraging new folks to programming to code... PHP teaches programmers bad habits like excessive use of global namespaces, and generally is accomplished with poor editing style becuase it is inlined with HTML, which has different needs for editing/indentation/etc.
A more appropriate introduction for this audience to programming might be python and TAL (template attribute language - the core of Zope's Page Templates, and the only vendor-neutral industry standard, cross-language templating system beside XSLT). I'm not suggesting Zope is appropriate for everyone (though for big apps, it really is best), but perhaps mod_python + page templates would be a better alternative for lightweight web-based scripting than PHP.
PHP does not work well for team programming, and Python does. If you are developing applications in a vacuum, by yourself, this may not matter, but on a team where you need to have coders of many skill levels, business managers, and designers interact, you really need to divide logic from presentation, and use componentized code with explicit namespaces to enable that sort of interaction. Otherwise, it just more <?PHP include("./someunknownquantity.php"; ?> magic.
Well, of course you can do anything in perl. First you write a routine that emulates a Turing machine ...
Those who do study history are doomed to stand helplessly by while everyone else repeats it.
van Rossum :
parent poster (Slothrup) :
Yes, I was also surprised at this large factual error.
GPL Version 2 : June 1991
GPL Version 1 : February 1989
Earlier forms of Copyleft licenses also existed from before 1989. The Free Software Foundation was founded in 1985 and has of course always released its work as 'Free Software'.
p.s. Slothrup, I suggest evening tea at Miss Quoad's would be a suitable punishment for van Rossum's inaccuracy. As a man who named his language after an English comedy group, I'm sure he has the required sensibility to appreciate the full horror of this particular engagement.
You have obviously not tried using Python. That's your loss. I have yet to hear of a whitespace bigot who tries Python for a few weeks who doesn't change their position regarding the use of whitespace as a block delimiting mechanism. The degree of the conversion ranges from sheepishly admitting that it works very well, to becoming raving supporters of Python because the feature works so well.
Proper indentation of a program is considered good style in all computer languages, including Perl. It is simply good programming practice to indent consistantly within a program. Python simply requires that good style be used in a program, rather than leave it as an option. This seems to irritate many narrow-minded, lazy, and sloppy programmers who think curly braces are the only proper way to denote blocks of code.
And regarding your example code, the same can be done trivially in C++ with the added significant bonus of strong static typing:Three lines of Python, three lines of C++ (barring the typedef, which is only there to make the rest of it easier to read).
You've been fed a batch of bad Kool-Aid. Fortunately, it's not too late to come around.
It's what LISP brings to the table above and beyond being a programming language (as most programmers think of the term) which makes it so astonishingly wonderful.
Build Your Own Syntax. See why I say it's difficult? You haven't ANYTHING done for you in advance.
Presto. Right there's a merge done in eight lines of code. It's generalized to the point where it works for anything, provided you give it an appropriate comparison function. And note--I didn't need anything big and fancy to do it. No imports or includes, no useless structural scaffolding...
LISP provides you with all the tools you'd expect of a modern programming language. The beauty of LISP is that you can do a hell of a lot of things in very small amounts of code without needing anything special. Ever seen someone write a PROLOG interpreter in 150 lines of LISP?
But how do to learn to create those domain-specific languages?
You start by doing, of course. You start by solving just one little part of the problem set, and you'll get about fifty lines in and you'll realize, "wouldn't it be nice if the language allowed me to do $foo?" Then you go off and make the language do $foo. Lather, rinse, repeat, until you've got thousands of lines of code creating a new special-purpose language to solve problems in a given problem domain, and five lines of code that actually solve your problem.
It is so far away from conventional academic lectures
Ever taken a Computational Theory course? LISP and LISP-like languages are used very heavily in Computational Theory courses precisely because they're so intimately tied to the lambda calculus, which is a formal model of computation.
And at MIT, introductory CompSci students are taught in Scheme, so you can't even say it's far removed from undergraduate lectures, either.
that one needs to forget almost everything to start thinking that way!
Yep. You do need to forget everything in order to start thinking that way. That's why it's called progress. Once you grok LISP and the lambda calculus, you not only see how to recreate all the old ways of doing business--you see how the old ways of doing business actually work, because now you have a formal model of computation to fall back upon.
And I'm not convinced that that syntaxlessness is indispensable
Syntax is necessary because otherwise you're left with a jumbled mess--sound and fury signifying nothing. If I pound out random letters at my keyboard I can say that it's the complete works of Shakespeare ("yes, dsfw98eradjct9e! is actually `to be or not to be'"), but that doesn't mean anyone can comprehend them.
To that extent, LISP has a very strong syntax. Don't mistake the simplicity of LISP's syntax for a simplistic syntax. LISP's syntax is extremely regular and extremely simple--far more than any other language I've come across.
If the matter is problem solving, just learn problem solving, not Lisp language.
LISP is a language meant specifically to solve problems. Where's your problem with it?
I would prefer to have some syntactic sugar which does the code more readable than those ((if()(and no then)(nor else keywords))s)
Get a good IDE and spend a few hour
In python, it is always 8 spaces. It's considered bad style to use tab. If you use emacs, then emacs will automatically use the correct settings in python mode.
The simple fact is that if you ignore the usual style guidelines for any programming language, there are obvious gotchas. The whitespace gotchas you mention are relatively harmless, as they are caught by the compiler.
There is no way to tell!
There are a lot of ways to tell. For example, in vim, :set list displays tabs as ^I and displays a $ sign on the end of each line.
You can't type in a program printed on paper and be sure that you got the whitespace right.
Spoken like someone who's never tried. Seriously -- never had a problem with this.
Often you can't even be sure that you will get the same whitespace if the program is distributed over the internet as text.
Save to file, and whitespace is preserved.
Until Python replaces significant whitespace with printable characters, it will always be a poor second to Perl in my book.
Pleasing anonymous morons is not one of the design goals of python. Sorry.
First off, as others have pointed out, you don't need to introduce a new class to do this kind of thing - C++ has vectors and pairs built in, and tuples will probably be in the next version of the standard.
However, you're right about the 'easy to instantiate' part, but I don't think static typing is really the problem. The problem with types in C++ is that you have to explicitly mention them, when a lot of the time the compiler could figure them out itself. In your example, you could do:
std::vector<std::pair<std::string, std::string> > entries = get_address_entries();
The type declaration isn't really necessary - the compiler knows that get_address_entries() returns a vector of pairs of strings, so could give the variable it's proper type. There's been some discussion about introducing type-inference into the language, so you could say:
auto entries = get_address_entries();
Which would make this kind of thing as easy to use as Python, while keeping the advantages of static typing in tracking down errors.
I don't get to program much, since I have a day job, and to make matters worse, my formal training with computers was brief. Basically, I learned Python on public transport, communiting to and from work (the Python Cookbook causes people to turn their heads, by the way). I tried learning Java at one point, but the problem is that there are too many details and formalisms that you have to remember to even get anything off the ground.
Not so with Python. Basically, you just write what you want to code. Want to know if there are characters in a string?
(This is new in Python 2.3, and I can't get the indentation to work here). Fantastically intuitive.
The only "problem" is the way the library keeps growing from release to release: Something that you had to code yourself a while back suddenly is a trivial feature. More of an embarrassment of riches than a real problem, but it does make you feel like a fool sometimes. "Why code that socket server? Just use..."
One other nice thing about learning Python is how amazingly friendly and helpful their tutor list is. I've asked some amazingly stupid questions in my time, and they have been very gentle and kind.