How to combine Python and Erlang?

Overview of Pyrlang Library, a Python library, that implements Erlang distribution protocol 
21 August 2017   507

Python is the most popular 2017 programming language, according to the IEEE Spectrum index. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.

Erlang is a general-purpose, concurrent, functional programming language, as well as a garbage-collected runtime system. Elixir, one of the most popular "young" programming language, runs on the Erlang virtual machine (BEAM).

How to combine Python and Erlang?

For this purpose, Pyrlang Library will suit. 

Pyrlang is a Python library which implements Erlang distribution protocol and creates an Erlang-compatible node in your Erlang cluster.

You can send and receive messages, spawn “processes” on Python side, which will be addressable from Erlang using familiar Erlang concepts like message sending to process identifiers or registered names. Also same works from Python: you can address Erlang processes, send messages to them, monitor and link with them.

The library is designed to be dropped into existing code base with very few changes required.

Learn more at official website.

What is YAPF?

A formatter for Python files, developed by Google team
30 October 2017   446

What is YAPF?

Most of the current formatters for Python --- e.g., autopep8, and pep8ify --- are made to remove lint errors from code. This has some obvious limitations. For instance, code that conforms to the PEP 8 guidelines may not be reformatted. But it doesn't mean that the code looks good.

YAPF takes a different approach. It's based off of 'clang-format', developed by Daniel Jasper. In essence, the algorithm takes the code and reformats it to the best formatting that conforms to the style guide, even if the original code didn't violate the style guide. The idea is also similar to the 'gofmt' tool for the Go programming language: end all holy wars about formatting - if the whole codebase of a project is simply piped through YAPF whenever modifications are made, the style remains consistent throughout the project and there's no point arguing about style in every code review.

The ultimate goal is that the code YAPF produces is as good as the code that a programmer would write if they were following the style guide. It takes away some of the drudgery of maintaining your code.

Code examples

YAPF takes this code:

x = {  'a':37,'b':42,


y = 'hello ''world'
z = 'hello '+'world'
a = 'hello {}'.format('world')
class foo  (     object  ):
  def f    (self   ):
    return       37*-+2
  def g(self, x,y=42):
      return y
def f  (   a ) :
  return      37+-+a[42-x :  y**3]

and reformat it into:

x = {'a': 37, 'b': 42, 'c': 927}

y = 'hello ' 'world'
z = 'hello ' + 'world'
a = 'hello {}'.format('world')

class foo(object):
    def f(self):
        return 37 * -+2

    def g(self, x, y=42):
        return y

def f(a):
    return 37 + -+a[42 - x:y**3]

See GitHub for more information.