Interviews: Q&A With Guido van Rossum 242
Guido van Rossum is best known as the creator of Python, and he remains the BDFL (Benevolent Dictator For Life) in the community. The recipient of many awards for his work, and author of numerous books, he left Google in December and started working for Dropbox early this year. A lot has happened in the 12 years since we talked to Guido and he's agreed to answer your questions. As usual, ask as many as you'd like, but please, one question per post.
From Google to Dropbox (Score:5, Interesting)
What prompted the move from Google to Dropbox? What did you do at Google, and what are you going to do at Dropbox?
GIL (Score:5, Interesting)
When will you remove the GIL?
Re:GIL (Score:5, Informative)
Re: (Score:2)
Re: (Score:2)
Explanation (Score:4, Informative)
Re: (Score:2)
Who's watching (Score:5, Interesting)
Does the NSA have access to our Dropbox contents, as is apparently the case with Microsoft Skydrive?
Re: (Score:2)
did you look at the prism slides? guess whos logo is up there with ms, google, skype, and yahoo? dropbox. they have to listen to nation security letters and blanket fisa court orders just like everyone else.
Re: (Score:2)
NSA has access to any contents that is hosted on the servers that are located on the US soil.
BC Breaking changes in 3 (Score:5, Interesting)
Do you regret the swath of backwards incompatible changes in version 3 that have lead to such slow uptake, or do you feel it was the best move for the language moving forward?
Re:BC Breaking changes in 3 (Score:5, Interesting)
Re: (Score:3)
You know it is entirely possible to write 2.7 code that works with nothing more than a pass through 2to3. That does mean that any libraries you depend on are available for 3.x but the problem of lacking support from 3rd party libraries is beginning to diminish as more are ported over at an increasing rate.
You can also start training yourself for the switch to Python 3 now by using all of the from __future__ imports which will also increase the ease of getting 2to3 output working when any missing support is
Re: (Score:2)
You know it is entirely possible to write 2.7 code that works with nothing more than a pass through 2to3. That does mean that any libraries you depend on are available for 3.x but the problem of lacking support from 3rd party libraries is beginning to diminish as more are ported over at an increasing rate.
It's also possible to write code for 2.6/2.7 which works fine with 3.3+. With the aid of the six module or similar ideas you can work around the differences. Many people think this is the best way to have joint compatibility with python 2 and 3. It also makes it possible to do the development with python3, which running 2to3 doesn't allow. As others have mentioned, there is no good 3to2.
Re: (Score:3)
Re: (Score:2)
Re:BC Breaking changes in 3 (Score:4, Insightful)
Why use a language that is interested in "backwards compatibility" when Python is into "forward compatibility". You can "import from future *" to make your code use features that are not yet in the latest release. Why embrace legacy ways of doing things when you can be focused on the future instead? I find the push to make it more perfect for the future a plus even if it means short term pain.
Re: (Score:2)
Agreed.
Re: (Score:2)
Re: (Score:2)
Re: (Score:3)
Name me a mainstream programming language which has only been intentionally backwards incompatible *once* in its 20 year history.
I can only think of C.
Re: (Score:2)
Re: (Score:2)
This is my #1 reason for not using Python. Why use a language that has no commitment to backwards compatibility when there are plenty that do?
Sometimes backward compatibility is not necessarily a good thing. Look how long Windows was dragged by the back-ward compatibility specter.
Or another example is Java. For fucks' sake, we never got Vector and Hashtable deprecated because ZOMG backward compatibility. And as result, we still get idiots using those god-forsaken-uber-synchronized classes instead of using their modern List and Map implementation counterparts.
I'm not saying that the Python 3.0 breakage from 2.7 is necessarily a good thing (th
Re: (Score:2)
Re: (Score:2)
Windows sucks, but not because of backwards compatibility. That is the positive aspect of windows.
Bleh, subjective, emotional. And I love Linux, and all *nix flavors in general (except HP-UX), been working with them for years (in web, enterprise and embedded). Still, even I won't be found saying that in such gross generic terms.
Re: (Score:2)
Interviews (Score:5, Interesting)
Guido
When you interviewed at Google - did they ask you brainteaser or hard algorithmic questions, and if so, what did you think of it?
Cheers!
Why did Python avoid some common "OO" idioms? (Score:4, Interesting)
Interfaces, abstract classes, private members, etc... Why did python avoid all this?
Re: (Score:3)
Re: (Score:2)
Interfaces, abstract classes, private members, etc... Why did python avoid all this?
I'm curious -- how many dynamically-typed languages have these features?
Re: (Score:2)
Python does have abstract classes [python.org]. They have also been backported to 2.6 for those that want to use them before transitioning to 3.x. See the numbers module [python.org] for an example of their use.
Re: (Score:2)
Re: (Score:2)
In python, that's correct. There's some method name mangling to ensure that devs writing code calling private methods know what they're doing, but otherwise it's allowed. In other languages (Java for example) private methods are completely hidden from outside classes.
Re: (Score:2)
Multi-line lambdas (Score:3, Interesting)
Re: (Score:3, Funny)
Re: (Score:2)
Re: (Score:2)
Well, it's yet another name. And one that would not have been needed if python lambdas were proper lambdas.
It's all a matter of convenience, and tripping over a disappointing and gratuitious limitation isn't nice either.
Re: (Score:2)
I disagree. I think the one-liners keep it easy to read. If you need more lines just make a limited-scope function. Is there some shortage on function names to choose from?
Re: (Score:2)
Re: (Score:2)
OTOH, Lua's handling of Unicode is as piss-poor as is C's. In both cases there are historical reasons why they developed the way they did, but the result is that they are nigh to unusable for many applications. (I'm not real thrilled with Java's 16-bit chars either. Either utf-8 or utf-32 is far superior.)
In particular, for my purposes no language that makes it difficult to determine the general category of a character is usable. Obviously this needs to be a library function, but nearly as obviously it
Re:Multi-line lambdas (Score:5, Insightful)
Solution:
1) Make it a named function.
2) Place the name where you'd otherwise put the lambda.
It works, although you have to deal with the horror of a reusable function defined a few lines up.
Re: (Score:2)
Re: (Score:2)
You can mutate them within the scope of that function, though.
If you're trying to mutate them *outside* the scope of that function, you need to go to a programmer re-education camp.
reasonable switch-case statement (Score:3)
Re: (Score:2)
Re: (Score:2)
Lambdas can only contain one expression, but that expression can have side effects. For example, we can wrap statements up into functions (which they should be anyway), we can call these functions from inside a tuple (the elements in a tuple are guaranteed to be evaluated in order) and we can get mutable local state by pushing and popping the elements of a list.
I wrote a rather rambly blog post about doing this http://chriswarbo.net/index.php?page=news&type=view&id=admin-s-blog%2Fanonymous-closures- [chriswarbo.net]
Why is Python so awesome? (Score:2)
Re: (Score:2)
Because it writes and reads like pseudocode, but works.
To elaborate a little, consider the phrase "write once, run everywhere". Do you ever write a program just once, and it runs correctly straight away? Python is the only language where I've experienced that, albeit after years of getting used to it. It's not perfect, though — I wonder if the same syntactical ingenuity could work with a really powerful language such as Fortran 90+...
It's a bit like the English language and IPA — why don't we just write everything the way it's pronounced? Would i
Best & worst of Python? (Score:3)
One thing different (Score:5, Interesting)
Re: (Score:2)
Gotta be the half-assed initial support for OO. Either that or the print statement :P
Re: (Score:2)
Gotta be the half-assed initial support for OO. Either that or the print statement :P
PyPy (Score:5, Interesting)
Do you see PyPy as the future ? http://pypy.org/ [pypy.org]
Or do you remain unconvinced, and -- if so -- why ?
Re: (Score:3, Interesting)
How to learn from you, with you... (Score:2)
Python in the browser ? (Score:3, Informative)
Over the years, there have been several attempts to create a sandboxed version of python that will safely run in a web browser.
Mostly this was because of problems with Javascript.
Now that Javascript works -- and we have nice things like CoffeeScript -- is it time to give up on python in the browser ?
Another BDFL (Score:4, Interesting)
What is your view on the tone that Linus uses on the LKML? Do you think it actually provides any benefits or just drives away would-be contributors?
GIL and true parallelism (Score:5, Interesting)
The main thing that keeps Python from being really useful for my projects is the Global Interpreter Lock (GIL). I would love to write Python for my data-intensive code, but it is impossible to get really good parallelism with Python; the multiprocessing library isn't a magic fix because then I have to move all my data back and forth between processes.
When, if ever, should I expect to be able to use Python to do parallel data processing? What is the priority for this, and what would need to be done to make thread-level parallelism possible?
Re: (Score:3)
And Jython doesn't work with numpy, which is one of Python's best features. The JVM is great for parallelism, but numerical computing on it isn't very fast.
Re: (Score:3)
IronPython is quite alive - they put up a new release candidate just two days ago. Note that their source repo is on GitHub these days, even though the binary downloads are still on CodePlex.
Of course, the real problem with IronPython (and Jython) is that you can't use the multitude of Python libraries that use native code and the CPython extensibility API.
Re: (Score:3)
I take your point; Python isn't the tool for proper threading.
Nevertheless, I think your claim that "people who need threads are already using other technologies" isn't true. I think people keep butting up against that need as their projects grow, and it forces them to (painfully) move away from Python. I think Python could better serve those users with good parallelism.
Re: (Score:2)
I think for my purposes, "Use Julia" will eventually be the answer. But I'd be happier if Python could just do what I want.
Python 3 Regrets (Score:4, Insightful)
name of the language (Score:2)
Do you wish you'd named your language after a different type of snake?
P.S. Yes I know it's from "Monty Python". If it'd been my language I would have called it Groucho.
Key question for any language designer (Score:5, Interesting)
Have the prospects of Python in any way improved since you grew a beard [c2.com]? To what degree does language success correlate to beard length?
Any NSA backdoors in Python ? (Score:2, Interesting)
Are you aware of any attempts by the NSA to add a backdoor in Python ? ;)
Of course, if you did get an NSA letter, you wouldn''t be allowed to say.
You are welcome to NOT ANSWER this question.
We will take note of that
functional programming (Score:5, Insightful)
Some people claim that Python is, at least partly, a functional language. You disagree, as do I. Simply having a few map and filter type functions does not make for a functional language. As I understand it those functions were added to the libraries by a homesick Lisper, and that several times you've been tempted to eliminate them. In general it seems you're not a fan of functional programming, at least for Python.
Question: do you feel that the functional programming approach is not very useful in general, or simply that it's not appropriate for Python? It would be nice to hear your reasons either way.
Re: (Score:2)
Just wanted to say that if Python lacked the functional stuff, I wouldn't it like it nearly as much.
NSL (Score:2, Offtopic)
why should I adopt Python 3? (Score:4, Interesting)
I am not able to do the switch now as I rely on some libraries that have not finished converting to python 3 yet, but having something to look forward to other than the pain of backwards-incompatibility could go a long way in getting me to prepare for the change instead of ignoring the issue.
Re: (Score:2)
I feel that the reasons are evident in the release notes that describe the new features in 3.1, 3.2, 3.3...
The more interesting question to me is what he thinks of the serious lag in library support for Py3, which I posted below.
Re: (Score:3)
I feel that the reasons are evident in the release notes that describe the new features in 3.1, 3.2, 3.3... The more interesting question to me is what he thinks of the serious lag in library support for Py3, which I posted below.
Care to point out some highlights? A little bit of evangelism would not hurt. If you ask Stroustroup what are the cool new features of C++11, he has a good answer ready. Other than the new unicode support, which is very important in some contexts but not everywhere, I see nothing else that's very exciting looking here: http://docs.python.org/3.0/whatsnew/3.0.html [python.org].
Import Everything (Score:2)
Python as a shell language (Score:4, Interesting)
The main obstacle to this use-case is python's semantic spacing and lack of braces (or something):
- it is hard to do even a fairly simple if/else or loop in a single line so it will interact nicely with the terminal's history
- it is hard to cut&paste code into the terminal because you have to be wary of leading spaces
Ipython tries to solve some of this with shortcuts to bring up a built-in editor, which is an approach that works but is quite cumbersome.
Do you think convenient usage on the interactive shell is a worthy goal that the language should support? if so, is there any direction the language or libraries could develop to better support it?
Re: (Score:2)
Re: (Score:2)
Yeah, I agree, I've also reluctantly come to the conclusion that significant whitespace as the only option can suck a bit - places too many demands on the editing tools, clipboard etc. Definitely a double-edged sword.
For the use-case you're talking about, something like ruby or javascript (!) or a lisp would be better.
But python is nicer to read and has great libraries for a lot of things. Hey-ho. Can't have everything, eh?
I really don't see why you can't have both. Even just a shell dialect of python with no semantic leading space and braces would largely solve the issue and make python a better bash in addition to what it already is.
A big advantage of python-as-a-shell is that it can direclty import and invoke all the available libraries and all of our python code (javascript?! it doesn't even have a decent date library, let alone math!). And with ipython plus python's native reflection and documentation support, you ca
GIL vs. Stackless model (Score:2)
I've played with stackless and depending on what you're doing it can leverage huge benefits.
If you were to design Python from scratch... (Score:2, Interesting)
Guido, if you were to design Python from scratch now (without any constraint and legacy code using the old Python), what would you change and how different would it be from Python 3?
What is your programming environment like today ? (Score:5, Interesting)
How often do you get a chance to write serious code ?
What's your default OS ?
Command shell ?
Version control ?
Editor ?
IDE ?
Web browser ?
IM client ?
email client ?
late nights or early rise ?
Python 3 (Score:4, Interesting)
How do you feel about the current state of the migration to Python 3 (Py3k)?
From a user perspective it seems that the conversion of popular libraries has lagged far behind, which has impeded the transition. In my professional capacity, nearly every single system I use lacks an installed 3.x interpreter. In fact, 2.7 is a rarity. I'd like to get your thoughts.
Re: (Score:2)
Python and cutting edge language features (Score:2)
I'd like to get your thoughts on Python as it compares to some of the newer developments in programming languages. In the past few years, the hyperactive growth of the web in the mobile space and in so-called "cloud computing" have spurred all kinds of new languages from new upstarts and companies like Google (go, dart); as well as new features in established languages like C#, Java, C++. How do you think the cutting edge of Python will compare to people who might be lured away by those new toys? Or, in
Perl 6 (Score:2)
Perl 6 is an ambitious new programming language in the Perl family.
Have you read the Perl 6 specifications [perlcabal.org]?
What do you think of the Perl 6, the language (syntax changes) and its new features (meta-operators, advanced OOP, built-in paralelism, signatures as first class objects, grammars)?
That OO-My-God Moment of Emergence (Score:2)
Emergent OOism -- that everything is an object, including the variable types -- can provide continual surprises of what is possible, even to veteran programmers in other languages. As you were developing and using Python, Guido, what was your favorite surprise? What was now easily possible using Python that would have been very difficult with another language (at the time, or even nowadays)?
Mine: a dictionary of lambda functions for parsing text, and writing a custom MapReduce capability for AWS in 372 lin
Python code on Git (Score:2)
Hello,
The Git distributed version control system is today the most used for the OSS projects. This was not the case back to the day when the Python project selected Mercurial to store hi source code. After all, at this time the mass of users of a specific SCM was not a important parameter for the decision since a bunch of a new generation of SCM was relatively new. Now, several years later, the Git audience is several order of magnitude bigger than the Mercurial audience. It has also proved to be appropriat
Re: (Score:2)
Yes, it make difference:
* If you have to integrate the source code into a bigger project. Some specific features might touch more than a single project to be complete (typical case is driver+lib+binding). Keeping trace of all the change is far more easy if there uses a common SCM tool.
* Submit a clean patch to a project where you are not a regular contributor (typical case is a bug on a specific load) is a time consuming task. Each project have his set of rules about the coding style, and how to submit the
Conditional Expression. (Score:2)
Though I've since grown accustomed to it, when PEP 308 was first resolved the grammar of the conditional expression ("X if C else Y"), placing the conditional as it does in between the choices, struck me (and not me alone) as particularly odd. Does this reflect your mischievous sense of humour, or am I missing something because I'm not Dutch?
Re: (Score:2)
Re: (Score:2)
When will Python support lightweight threads for CPU bound workloads?
Re: (Score:2)
Will Python get a fast parallellization module for CPU bound problems on shared memory architectures?
Re: (Score:2)
http://ipython.org/ipython-doc/dev/parallel/
If you use that you can keep your "engines" (= processes) running to avoid the overhead of spawning processes. But the inter-process communication will still be slow (I believe they also use pickling) unless you use MPI for communication (which limits the datatypes that you can transfer and adds some extra programming overhead).
Re: (Score:2)
if you want to joke about indentation:
at least make it syntactically sound
while you're at it:
follow pep8
Re: (Score:2)
Re: (Score:3)
I've commented on python and whitespace enough times, that it became more practical to create a small web page about it: Read it here [dnsalias.org].
Much as I love python, I see nothing to refute my objections to python's use of semantic spaces and lack of braces or other equivalent construct.
- It makes python ineffective as a shell-replacement language, because you can't easily do a complex one-liner and then retrieve it from history
- It makes cutting and pasting code difficult, which makes refactoring unnecessarily painful
- It makes it impossible to fully auto-format code: all formatters I have seen for python do not trust themselves to touch le
Re: (Score:2)
File "<pyshell#0>", line 1, in <module>
range(['a', 'b', 'c'])
TypeError: range() integer end argument expected, got list.
Re: (Score:2)
There's a difference in design philosophies which explains the difference perfectly well. From pep-20 [python.org]:
Explicit is better than implicit.
The Python way of doing what you want to do is:
range(len(['a', 'b', 'c']))
That way, someone reading it doesn't have to look up the range function to know why the interpreter treated ['a','b','c'] as equivalent of 3.
By contrast, perl is built with implicit assumptions all over the place so that a programmer experienced in perl doesn't have to type as much. The best known example of this is the $_ variable, w
Re: (Score:2)
If you want ALL the attributes to be read-only, you can use collections.namedtuple.
This sort of control over other developers is generally considered un-Pythonic because it violates the "we're all adults here" principle. If the documentation says "Don't assign to X", you know you are taking your chances when you do it. If you feel that you have a good enough reason to do it, bully for you, but don't complain when it breaks.
One feature Python already has which violates this principle is the '__' prefix n
Re: (Score:2)
Python 3.3 has been released in September 2012, but the asynchronous features are not yet there.
Re:(Optional) Static Typing / type hints (Score:2)