In Silicon Valley is a very exclusive fast-food restaurant, which is always open. There is one table, where one guest at a time is served an absolutely fabulous hamburger. When you arrive, you wait in line until the table is available. Then the host takes you to the table and, this being America, you are asked a seemingly endless series of questions about how you would like your hamburger to be…
In late 2005 I joined Google. The interviews took a surprising long time, which is a tale for another time. Today I want to tell a story that happened in one of my first weeks on campus. In the main building was an impressive staircase going up to the second floor. Somewhere near the top was a spacious office. A very important engineer worked there. I checked the name on the door and realized I…
This is something I posted on python-ideas, but I think it's interesting to a wider audience. There's been a lot of discussion recently about an operator to merge two dicts. It prompted me to think about the reason (some) people like operators, and a discussion I had with my mentor Lambert Meertens over 30 years ago came to mind. For mathematicians, operators are essential to how they think. Take…
I regularly receive questions from students in the field of computer science looking for career advice. Here's an answer I wrote to one of them. It's not comprehensive or anything, but I thought people might find it interesting. [A question about whether to choose a 9-5 job or be an entrepreneur] The question about "9-5" vs. "entrepreneur" is a complex one -- not everybody can be a successful…
I'm turning off commenting for my blogs. While I've enjoyed some feedback, the time wasted to moderate spam posts just isn't worth it. Thank you, spammers! :-(
Union syntax (I'm trying to do this as a quick post in response to some questions I received on this topic. I realize this will probably reopen the whole discussion about the best syntax for types, but sorry folks, PEP 484 was accepted nearly a year ago, after many months of discussions and hundreds of messages. It's unlikely that any idea you can think of here would be new. This post just…
Type annotations for fspath Python 3.6 will have a new dunder protocol , __fspath__() , which should be supported by classes that represent filesystem paths. Example of such classes are the pathlib.Path family and os.DirEntry (returned by os.scandir() ). You can read more about this protocol in the brand new PEP 519 . In this blog post I’m going to discuss how we would add type annotations for…
The AnyStr type variable I was drafting a blog post on how to add type annotations for the new __fspath__() protocol ( PEP 519 ) when I realized that I should write a separate post about AnyStr . So here it is. A simple function on strings Let’s write a function that surrounds a string in parentheses. We’ll put it in a file named demo.py : def parenthesize(s): return '(' + s + ')' It works, too:…
Today the Netherlands celebrates King's Day. To honor this tradition, the Dutch embassy in San Francisco invited me to give a "TED talk" to an audience of Dutch and American entrepreneurs. Here's the text I read to them. Part of it is the tl;dr of my autobiography; part of it is about the significance of programming languages; part of it is about Python's big idea. Leve de koning! (Long live the…
After much back and forth I received a nice new Python book in the mail. The book's full title is " Introduction to Computer Science Using Python: A Computational Problem-Solving Focus ", and its author is a very experienced educator, Charles Dierbach. This is not your average Python book -- it is a college text intended for first-semester CS courses that happens to use Python. As such, in assumes…
Dear (insert name here), I heard you enjoy a certain programming language named Python. Programming is a wonderful activity. I am a little jealous that you have access to computers at your age; when I grew up I didn't even know what a computer was! I was an electronics hobbyist though, and my big dream was to build my own electronic calculator from discrete components. I never did do that, but I…
With the most recent release (1.5.3, last week) App Engine's Python API for Memcache has added a new feature, Compare-And-Set . This feature (with a different API ) was already available in Java; it has also been available in the non-App-Engine pure-Python memcache client . In fact, I designed the App Engine Python API for this feature to be compatible with the latter, since most of the rest of…
This morning I had a chat with the students at Google's CAPE program. Since I wrote up what I wanted to say I figured I might as well blog it here. Warning: this is pretty unedited (or else it would never be published :-). I'm posting it in my "personal" blog instead of the "Python history" blog because it mostly touches on my career before Python. Here goes. Have you ever written a computer…
As of late I'm noticing a trend: I'm spending more time having in-person in-depth conversations, and less time coding. While I regret the latter, I really enjoy the former. Certainly more than weekly meetings, code reviews, or bikeshedding email threads. (I'm not all that excited about blogging either, as you may have guessed; but some things just don't fit in 140 characters.) Two conversations…
While I was laying the groundwork for a new datastore client library with support for asynchronous requests, I added some low-level support for asynchronous RPCs that you can use today. The only App Engine API with documented support for asynchronous RPCs is urlfetch , and it happens to be quite useful with that. Suppose you want to fetch some data from a remote service. The remote service has two…
This post is primarily intended for App Engine users (and of those, only Python users :-). Over the past months I've been working on a new design for the Python datastore API, under the code name Datastore Plus. The new design is very ambitious, and changes a lot of things: New, cleaner implementations of Key, Model, Property and Query classes High-level asynchronous API using Python generators as…
Here's an idea that is just begging to be implemented as a Firefox extension. You know how there's a while-you-type spell checker that's always on when you are editing text in a multi-line text box? There should be a feature that takes the last few words you're typing (or the entire current paragraph, or whatever works best), does a Google search, and presents snippets for the top few results in…
Yesterday I attended a biweekly meeting of an informal a UC Berkeley group devoted to Python in science (Py4Science), organized by Fernando Perez. The format (in honor of my visit) was a series of 4-minute lightning talks about various projects using Python in the scientific world (at Berkeley and elsewhere) followed by an hourlong Q&A session. This meant I didn't have to do a presentation and…
I just heard from Bill Xu in China. His book "Lovely Python", an introduction to Python in Chinese, was just published and shot to the top-5 of china-pub.com 's bestseller list (at some point it even was #2). I can't read Chinese, but I am very glad that there's a book on Python available for Chinese readers, and that's why I wrote a brief foreword for the book as well. (Also because I am one of…
In yesterday's post I mentioned reading George Lakoff 's book, The Political Mind. While I agree with the politics of the book in almost every instance, I was still disappointed. For one thing, the book "compresses well." (IOW it contains a lot of repetition. A Lot.) It also felt a bit like a classic bait-and-switch: the back flap touts "the science behind how our brains understand politics" but…
[Warning: loose thoughts ahead!] Microsoft's Eric Meijer gave a talk at Google yesterday, and afterwards I had lunch with him. One of his remarks was (I paraphrase) that Microsoft users want to be told what to do, while the Java community is more vocal or argumentative. (He didn't discuss the Python community but in my experience it falls in the latter category.) Now, while lying sick in bed with…
While CPython still rules on python-dev, especially with the excitement around Py3k, Python's alternative implementations are growing up: PyPy is now capable of running Django, Jython just released version 2.5, and IronPython has been releasing significant milestones like clockwork. I get a lot of satisfaction out of such milestones: they help establish Python as a language you can't ignore, no…
I still read a few print publications, including IEEE Computer. Today's issue contained a high and a low: Today's high point was a detailed history of the Conficker worm. Since we're a Macintosh family, and Google typically has its security stuff in order, I was barely aware of it. The sophistication of the worm's creators is almost admirable. (They probably use Python too. :-) An interesting…
At Google I/O I received a copy of Using Google App Engine by Charles Severance, published by O'Reilly. I haven't kept track, but this appears one of the first App Engine books to actually hit the stores -- an Amazon search for App Engine showed up one other book ( Developing with Google App Engine by Eugene Ciara, published by APress) and many titles available for pre-order (including additional…
There's never a lack of books to use for learning Python. I occasionally receive books for review, but I don't have a particularly good yardstick to judge such books by: I find that they all contain some factual errors and some oddities of presentation, but I have no idea whether those matter for the readers. Even Knuth's books are full of errors: for example the errata for Vol. 1 (2nd ed.) are a…