12 ms·
Python 3 at Facebook
- aidos 8y agoThat’s a pretty large juggernaut to try to change. I’m surprised and pleased they managed to make it work. I wasn’t aware that Facebook used python so heavily. Presumably much of their code is in Js these days?
- holografix 8y agoI’d love to know what an entry level Python coder would earn and need to know to get a job at Facebook. I’m so tempted to try and get a job in software eng sometimes, it’s by far what I have the most fun doing.
- kajecounterhack 8y agoFWIW larger companies don't hire "x coders" where x is some language. They look for CS fundamentals, mastery of programming paradigms, and then you work in whatever language you need / makes sense given the task.
- s3m4j 8y agoJust yesterday I was talking with my teacher about how he was tired of students (and parents) asking if he would add x and y languages to the curriculum.
- cema 8y agoWell, unfortunately many (both tech and non-tech) companies still want to hire developers with "x years of y language, n years of m framework" and so on. So there is some reason to ask for specific languages in the curriculum, from that purely practical point of view. Not everyone goes to work to a top place.
- outworlder 8y agoYes, but that's still wrong. If you are at school, university, whatever that is, you need to be exposed to concepts. Those will rarely change. For instance, Lisp already had garbage collection and object orientation decades before they were available in mainstream language, and the basic concepts still have not changed. Once you understand then, learning a new programming language is done in a matter of days (libraries and common idioms takes more time). You are basically transferring concepts you already know to a slightly different implementation, but there will be hardly anything entirely new. More so for "mainstream" languages. Then you need practical experience, which do not require teachers to be involved.
- giraffe 8y agoI agree with this. But unfortunately my experience is industry tends to not agree with us. They are like 'cool you know fundamentals, now do this take home project that requires x programming language with m framework'. This isn't too nice for new hires that learn just fundamentals and not the tooling and frameworks industry expects new grads to have. Industry seems to expect CS degrees to be vocational degrees.
- kbp 8y ago> But unfortunately my experience is industry tends to not agree with us. They are like 'cool you know fundamentals, now do this take home project that requires x programming language with m framework'. This isn't too nice for new hires that learn just fundamentals and not the tooling and frameworks industry expects new grads to have. I think the idea is that you should be able to pick up the language and framework as you go, if you do actually have the concepts down. If your generalised knowledge isn't to the point where you can apply it to some arbitrary framework/codebase in some arbitrary (imperative) language and start being productive more or less immediately (with documentation open in another tab), then your generalised knowledge just isn't at the level where people care about it, yet. edit: That generalised knowledge they're expecting absolutely might go beyond what you're shown in school (it depends on the school). If you draw the line of "fundamentals" at "what was in my curriculum", then that's an arbitrary line you're drawing, and it's not the line that most of the industry is using (even if people are using their own coursework as their meter). If you consider (eg, in a web dev context) HTTP requests and MVC "fundamental", then you should be able to pick up Rails or Django or whatever without much trouble. Whether or not your school had classes on that doesn't really matter to anyone.
- TooBrokeToBeg 8y agoFWIW that's not a true statement. Large companies have roles and vacancies where there are expectation and existing code to maintain.
- pdpi 8y agoVaries a lot. E.g. when I was at FB I joined a C++ team while having written about 200 lines of C++ before in my life — we also had proper C++ experts in the team, and they cared more about experience in the problem domain. All of these conversations were held _after_ I was hired though — the pipeline is a mixture of hiring experts for specific positions and "hire people that seem good enough, and let them find their own teams"
- malkia 8y agoSimilar with me, background in mostly C/C++/Pascal, etc. - joined Google and had to write Java - what surprised me mostly were: Killing app due to GC stress, Dependency Injection, Checked Exceptions and using various containers (map, set, etc.) as an interface without assuming concrete implementation (or maybe not so). Didn't graduate well from this "program", but give full respect to Java now. Back to C++ land for me, and it's been good.
- praneshp 8y ago> then you work in whatever language you need / makes sense given the task I think this simplifies the truth too much. At least in my limited experience, you work in whatever language your team is working in.
- joshuamorton 8y agoDepends, I'm currently coding almost entirely in python, the guy behind me is using almost solely C++, and the person to my right is working solely in Java right now. Last week I was split heavily between python and javascript, but will likely write very little JS in the near future. At that point, another person on my team was working heavily in Go, although that is also finished now. Its not just "what your team works on", but what fits the task/what the existing tooling is in. If you're only working on a single product/project ("I develop the android app for XYZ product"), you likely work in the same language or two as the rest of your team. But that isn't always the case.
- outworlder 8y agoUsually, yes. But it does not mean that you should use a screwdriver to drive a nail just because that's what others are doing. They may be working with screws. In more practical terms, you are not going to write a cronjob in java just because that's what the main system is written in.
- yeeeeeeeeee 8y agoI think in this context "you" can be interpreted as "the team."
- outworlder 8y agoThe statement is true for many teams in the best tech companies. Many of the "crappy" companies do look for "X programmers" even when there is no need, just because of the tech they are currently working on at that specific point in time. Even when they are large (especially when they are large, it would seem).
- kej 8y agoIf it's what you enjoy and you're not tied into a different job for other reasons, go do it. I'm not sure what Facebook's requirements are like, but there are tons of places that would hire someone with Python skills at a decent salary. https://www.payscale.com/research/US/Job=Software_Engineer/Salary/9957ee09/Entry-Level-Python https://www.payscale.com/research/US/Job=Software_Engineer/S...
- akhilcacharya 8y agoThey don’t care about language, they care about algorithm ability (specifically solving problems quickly) and system design ability at higher levels.
- outworlder 8y agoThe best advice I can think of is to get involved with open-source. You'll learn a lot by working with your peers (some of which may be even at Facebook and other companies) and you'll figure out what you need to learn. You'll also end up with code you can show, and evidence of being able to work in a team and complete actual tasks. This is huge for prospective employers.
- pushtheenvelope 8y agoFacebook code kinda has three layers: 1. clients (Objective-C for iOS, Java for Android, JS for Web and React Native) 2. application logic (Hack) 3. services (c++ and python are most prominent and well-supported, but there's a long tail of languages like Java, Haskell, OCaml, Ruby, etc.) The prominent languages in each layer have pretty substantial code-bases. More importantly, there's an engineering culture of eschewing "code ownership" and encouraging "code upgradability" so that motivated folks like Jason can drive these large changes.
- wodenokoto 8y agoDid facebook drop php? I thought they were really vested in it, with their HipHop VM and whatnot.
- yunyu 8y agoHack is a typed variant of PHP.
- sopooneo 8y agoDid they create Hack before PHP 7, which has near full typing on its own?
- Implicated 8y agoYes.
- ckwalsh 8y agoYes, and the php7 typing system is heavily influenced by Hack. However, Hack goes further with support for more typehint features + a typechecker daemon
- codetrotter 8y agoFirst they made HHVM for PHP and then they made the Hack language for HHVM. Hack is based on PHP. I don’t know how much non-Hack PHP they still have but it is my impression that they turned pretty much all of their PHP code into Hack code. https://hacklang.org/ https://hacklang.org/
- Thrymr 8y agoJason Fried says [0] that Facebook has "tens of thousands" of python entry points in its codebase (55% and growing are Python 3). [0] https://www.youtube.com/watch?v=H4SS9yVWJYA https://www.youtube.com/watch?v=H4SS9yVWJYA
- piyh 8y agoWhat is meant by python entry points?
- ForHackernews 8y agohttps://stackoverflow.com/questions/774824/explain-python-entry-points#9615473 https://stackoverflow.com/questions/774824/explain-python-en... Very roughly speaking, a way in which a script can invoke a piece of Python code.
- blattimwind 8y agoAn installation-wide (system, virtualenv) association of a (type, name) tuple with an importable Python object (usually callable).
- ksec 8y agoI had to google and double check. Because the first Jason Fried I have in my mind is Founder, CEO of basecamp, Ruby Rails. And I thought when did he became a python guy? Turns out there is another person in Facebook with the same name.
- stock_toaster 8y agoI was super confused too. Thanks for sorting it!
- shafte 8y agoMuch of Instagram's application code is written in Python. Python also powers some service infrastructure. For example, FB's release automation system is written in Python.
- stigi 8y agoBesides what other people have mentioned FB is also one of the biggest Mercurial (which is build in Python) users out there and has a few developers working on it exclusively.
- chucksmash 8y agoThere's also Mononoke[0], a "Mercurial source control server, specifically designed to support large monorepos" which they're working on in Rust. [0]: https://github.com/facebookexperimental/mononoke https://github.com/facebookexperimental/mononoke
- mark-r 8y ago> When they ran the resulting code, they found it was 40% faster and used half the memory. This points to a persistent myth that Fried has heard: Python 3 is slower than Python 2. That may have been true for earlier releases of Python 3, but it is definitely not true now, he said. I wonder why that is? My theory is that it has to do with the new Unicode encoding; if 99% of your strings are ASCII compatible, the new encoding will be twice as efficient. Seems unlikely that would account for all of it though.
- pletnes 8y agoOptimizations of the dict class (both memory and cpu wise) in python 3.5+ are pretty important, as it’s used a lot internally. E.g class members and methods are stored in a dict. This basically affects all python code.
- rectangletangle 8y agoThe dictionary implementation changes are the biggest speed up I can think of. They touch nearly everything in the language. One of the interesting side-effects of this, is in 3.7+ dictionaries are now ordered by insertion, which I'm sure will help fix tons and tons of subtle non-deterministic bugs (and probably expose a few too). Although I'm not 100% on the performance characteristics of the new unicode implementation. The unicode first string handling is a massive improvement when it comes to non-English languages. So IMO it's worth a hefty performance hit, based solely on it's own merits. In practice, it hasn't seemed to make a meaningful difference to me. So I'd wager it's good enough, unless you're hitting some sort of use case specific bind. In which case, it's probably time to leverage the C bindings anyway.
- johnramsden 8y agoRepost of https://news.ycombinator.com/item?id=17413350 https://news.ycombinator.com/item?id=17413350
- trevor-e 8y agoWhy does it say this was posted 2 hours ago and yours 1 hour ago?
- std_throwaway 8y agoCould this be a delay due to waiting for moderation approval?
- johnramsden 8y agoI guess because of a moderator updating the post. As you can see it was posted 17 hours ago https://news.ycombinator.com/submitted?id=johnramsden https://news.ycombinator.com/submitted?id=johnramsden
- sctb 8y agohttps://news.ycombinator.com/item?id=17419144 https://news.ycombinator.com/item?id=17419144 It's rare that we rescue an older story and while it's waiting to get re-upped another repost gets traction, but that's what happened.
- hyperbovine 8y agoTo save you the trouble of Googling: this is not the Jason Fried that more or less co-invented Rails.
- cityzen 8y agoI don't think Jason Fried co-invented Rails, I think that was all DHH.
- deleted 8y ago[deleted]
- NelsonMinar 8y agoI was surprised there was no mention of six.py. In my experience it's been a key enabler for 2->3 transitions. But maybe not at Facebook?
- AceJohnny2 8y agoIt's disappointing to me that six.py hasn't yet made it into 2.7's standard library. That would definitely help enormously.
- rspeer 8y agoThe standard library is where code goes to die. If six were in the standard library, it would be as stagnant and impossible to fix as 2to3.
- cup-of-tea 8y agoThere is also python-future which does similar things, I think.
- andrewshadura 8y agoYes, and python-future does it in a more Pythonic was, it seems to me
- martincmartin 8y agoWe definitely use it a Facebook, the linter suggests when you should use six instead.
- trumped 8y agoPython is really slow, but luckily, most python code can be optimized by improving the interpreter... maybe Facebook will release a better interpreter (there is already some faster interpreters, not sure why Python doesn't adopt them)...
- blake_himself 8y agoThere was an article somewhere recently, of someone proposing changes to CPython for just that reason. Guido had already resisted several attempts at the kind of thing he was doing, from a desire to keep the CPython implementation simple.
- eiji 8y ago> He wanted to tell the "story about how I and couple of engineers used our free time, with no authority whatsoever, and made Python 3 the dominant version at Facebook." Isn't it great when engineers upgrade your codebase in their free time.
- golergka 8y agoIt's great when you have the opportunity to use your free time to or something that impressive on your CV. I wouldn't pass on it, personally.
- bananadonkey 8y agoThis. I always take the opportunity to identify some long-term-beneficial changes which would look good on my CV, and run with them even if it means investing my free time before I can present the potential to the business.
- ipsum2 8y agoThis is the quote you focus on? Free time here here is probably defined as time in between their main projects, or when code is building, before meetings, etc.
- ilammy 8y agoBut you're still not supposed to get paid for that.
- Griffinsauce 8y agoYes you are, that's part of running a business. Your workers going the extra mile and creating business value in that time is a luxury.
- alexgartrell 8y agoI'm actually fairly certain it was "within working hours" free time. Facebook doesn't have 20% time or anything like that, but, in practice, there's lots of extra time for whatever you want. This was my experience as an Engineer at Facebook and I certainly "pay it forward" as a manager. Probably worth adding that we ultimately created a python foundation team, of which Jason is a member. Here's something dumb I created in my "within working hours" free time that Facebook let me open source: https://github.com/facebookresearch/py2bpf https://github.com/facebookresearch/py2bpf
- metabagel 8y agoI don’t believe it’s kosher to provide a subscriber link to everyone on HN. I believe it is intended to be used to communicate with a few colleagues, not to be posted on a news aggregator site. Per LWN.net: “The "subscriber link" mechanism allows an LWN.net subscriber to generate a special URL for a subscription-only article. That URL can then be given to others, who will be able to access the article regardless of whether they are subscribed. This feature is made available as a service to LWN subscribers, and in the hope that they will use it to spread the word about their favorite LWN articles. If this feature is abused, it will hurt LWN's subscription revenues and defeat the whole point. Subscriber links may go away if that comes about.”
- dmurray 8y agoSharing a single subscriber link and having it hit the front page of HN is unquestionably good for LWN and its revenue. Which is, as your quote says, the whole point.
- xapata 8y agoThere's probably some parabolic curve of revenue vs frequency of sharing subscriber links.
- otterlicious 8y agoThey're okay with it, in moderation: https://news.ycombinator.com/item?id=10236304 https://news.ycombinator.com/item?id=10236304
- bertr4nd 8y agoHa! The 2013-era linter he mentions that required “from __future__” imports was actually one of my bootcamp tasks! Hilarious and kind of gratifying to stumble across it in a random HN post all these years later.