5 ms·
Even at that scale, python code readability trumps over almost every other language out there. Compulsory indentation and there's only one way to do this mental
by samratjp 16y ago
Even at that scale, python code readability trumps over almost every other language out there. Compulsory indentation and there's only one way to do this mentality keeps everyone on the same page.
So, yeah, that's probably why Google uses python extensively.
- harryh 16y agoGoogle doesn't use python extensively. It's used as scripting glue in a lot of places but there are no actual products written in python. It's all Java and C++.
- samratjp 16y agoYou're right about that. I meant to say that even at larger organizations with big projects, python can succeed.
- stevvooe 16y agoMost of the youtube app servers are all written in python. Whether one considers this glue code is a philosophical question.
- DrJosiah 16y agoThe vast majority is Python (I'm a former 'Tuber). For a while, there was a real-time streaming/playlist/chat thing written in Erlang, but that's been gone for over a year now.
- angusgr 16y agoAre you at liberty to say why the Erlang thing got replaced? (Erlang & Python are my two favourite languages to use, but there are not that many problems I would interchange between them.)
- DrJosiah 16y agoThe Erlang thing didn't get replaced, it got removed. YouTube itself is an interesting project from the inside, though perhaps not that much different from any multi-featured website. Everyone has their own favorite features, their own favorite parts of the site, which they think will become "the next big thing", despite having a few orders of magnitude to go in order to reach the top 5 (which is 99.9% of the traffic). The chat/individual playlist thing was a cute feature, but it had maybe a few hundred concurrent users at any one time. If you consider that the recent Lonely Island video pulled about 3 million views in a 24 hour period, and was less than 1/333rd of YouTube's video views (using the publicly released 1 billion views/day number), you come to the realization that any code that isn't being used heavily, is effectively an unused feature that offers you nothing, and even worse, can't earn the site any money in ad revenue. Heck, I saw micro-communities as "the next big thing" on YouTube, and saw how poorly the original YouTube Groups fulfilled that. I envisioned small-medium sized forums where people would post, rate, and watch videos. I pushed and pushed and pushed until I got a little under a year to work on it, releasing Groups 2.0 in August/September of 2009. I watched how it was being used, got rid of some superfluous features, and pushed out an optional new version for people to use, which became the default on my birthday as my parting gift. Turns out that some code that I was relying on working from another part of the site had broken by another engineer, so they manually made it the default and only version a week or two after I left. Sadly, YouTube Groups is no more, having been turned down on December 1, 2010, code deleted a couple weeks later. A friend and former coworker who had maintained Groups after I left had pointed me off to a WWE fan group with over 100k video posts and a few hundred thousand members (which would be a huge success anywhere else). Since no one was really willing to truly maintain and improve it (I can't blame them, there were some nasty hacks in there), and it wasn't driving as much traffic as even one Lonely Island video, they tossed it. It probably didn't help that I'd ruffled some feathers with the ways I'd pushed for Groups; I'm surprised it lasted even that long. Ah well, many lessons learned, many good memories.
- angusgr 16y agoThanks for the great explanation. I must say that it sounds great Youtube's culture allows features to be "turned down... code deleted a couple weeks later". You don't always get that.
- DrJosiah 16y agoFrom 2006: http://panela.blog-city.com/python_at_google_greg_stein__sdforum.htm http://panela.blog-city.com/python_at_google_greg_stein__sdf... More recently: http://stackoverflow.com/questions/923225/does-google-use-python-for-anything-but-internal-utilities-and-administration http://stackoverflow.com/questions/923225/does-google-use-py... (includes a quote from Alex Martelli) The trick is that Python is a bit like special sauce. If your business is booming because of it's use, you are wary of expressing it as much, because it allows you to get so much more done so much more quickly than your competitors. If they find out, then they may have a chance to catch up. It always blew me away seeing startups using JSP, .NET, etc., when starting out. Get it done first, then make it fast (if you need to).
- RodgerTheGreat 16y agoI'm not really sure how Python's enforced indentation has anything to do with this. Java does not enforce an indentation style at compile time, but has a very well-established set of coding guidelines originally laid out by Sun that most coders follow. More importantly, Google has extensive coding guidelines for all the programming languages they use- their code will look consistent no matter what language they're working with.
- samratjp 16y agoI was just pointing out to the parent comment that it's not just the indentation but also the fact that a lot of things in python, there's one great way to do this is highly prevalent (and rewarded). This allows for easier readability in most cases. As about the indentation, the inherent nature of mandatory indentation significantly improves code reading quality which will allow someone new coming in to work with "100,000 to 1 million" lines of code an easier time blending in.
- enneff 16y agoI work at Google and we don't have that much Python in our codebase. There are some outlying cases that use it (like the YouTube front end), and it _is_ one of our official languages, but the vast majority of Google code is C++, Java, and JavaScript, with Python a trailing 4th place. Python is just not that suitable for large-scale software development. Readability means different things at different scales. Reading Python "in the small" is easy; it's looks like pseudocode. Once you start writing larger programs, between the 5k and 10k mark, the looseness of Python starts to become a burden. It can be very difficult to look at a piece of Python code in a large project and know exactly what it does. Dynamic typing means that a whole class of serious programming errors go unnoticed until runtime - and often only for a specific, uncommon input. ("Compulsory indentation" ?! Whomever works on a large project with others and doesn't format their code to the standard of the project should be taken out and shot. I'm only half-joking. Indentation has almost nothing to do with readability, though. It's just common sense.) (I'm surprised to hear you say "there's only one way to do this" with regard to Python, as in my experience there are always several ways of doing anything, and it's not uncommon to see different/competing approaches used in a single project.) I'm biased, but Go is a great choice for large-scale software development. It has the brevity of a scripting language, but being statically typed and compiled Go can be more reliable and efficient. It's also smaller and more consistent than any mainstream language. Because of this, you can typically look at a piece of Go code from any project and understand what's going on. This is because it's difficult to abuse Go in the same way you see done in the other four languages I've mentioned, and that is truly valuable at scale.