Slashdot Mirror


Google Boosts Python By Turning It Into Go (infoworld.com)

An anonymous reader quotes InfoWorld: Grumpy, an experimental project from Google, transpiles Python code into Go, allowing Python programs to be compiled and run as static binaries using the Go toolchain... In a blog post announcing the open source release, Google stated the project stemmed from its efforts to speed up the Python-powered front end for YouTube. But Google hit an obstacle that's familiar to folks who've deployed Python in production: It's hard to get CPython -- the default Python interpreter written in C -- to scale efficiently. "We think Grumpy has the potential to scale more gracefully than CPython for many real world workloads," writes Google...

Because it doesn't support C extensions, Grumpy doesn't have CPython's Global Interpreter Lock, which is commonly cited as a roadblock to running Python concurrent workloads smoothly. Grumpy also uses Go's garbage collection mechanisms to manage memory under the hood, instead of CPython's. Grumpy creates close interoperation between Python and Go by allowing Go packages to be imported and used with the same syntax as Go modules.

6 of 129 comments (clear)

  1. Re:A Logo Proposal by Anonymous Coward · · Score: 2, Informative

    I think the ouroboros symbols is used by PyPy (JIT compilation):

    https://en.wikipedia.org/wiki/PyPy

  2. Just another f***ing kludge to get around by CQDX · · Score: 5, Informative

    Python's GIL. Pythonistas keeping pushing for Python everywhere but don't realize that Python does have its limits and is not the language of choice if you need performance on multiple cores. In my experience, when you try to emulate multithreading in Python using some message passing scheme you end up with something that is more complicated, harder to debug and tune, harder to maintain, than the equivalent written in good C++.

    1. Re:Just another f***ing kludge to get around by CQDX · · Score: 4, Informative

      I'm using it right now. Embedded system, Python 2.7 (many legacy modules not 3.x compatible) on a multicore processor. I'm working on an existing Python based project that is very similar to something I did previously at another company in C++. Python is certainly easier to bootstrap a project but once you start dealing with high loads and trying to squeeze all the processing power out of a CPU I'm finding Python much harder to use over C++.

    2. Re:Just another f***ing kludge to get around by fnj · · Score: 4, Informative

      I think a lot of python users are not even aware of this. It's not a secret, and it's not just for lambdas. Semicolon is a perfectly legal statement separator in python. It's just that newline is ALSO a statement separator.

      if x < 1: print(x); print(y); print(z)

      is the same as

      if x < 1:
              print(x)
              print(y)
              print(z)

  3. Google buys innovative from outside by Anonymous Coward · · Score: 4, Informative

    Google didn't invent Python. That was developed by Guido R. at another organization. Years later, Guiodo went to work for Google, well after Python's ascendant popularity.

    Android was also developed by another company that Google later bought. Same thing with Youtube. Do you see a pattern yet?

  4. Re:Try JPython by yithar7153 · · Score: 3, Informative

    Yeah, this is why I love OCaml. OCaml has static typing with type inference. You don't have to type the types out if you don't want to, but you still get those strong guarantees at compile time because of mathematical proofs.

    My compilers professor said that he believed that type systems are the most important form of program verification that we have (See notes).