Python 3.5.4rc1 and 3.4.7rc1 released

Release candidates for two versions of Python programming language released
07 August 2017   436

Is a multi-paradigm programming language with easy-to-use syntax

Great news for Python developers. Two release candidates for versions 3.5.4 and 3.4.7 has been released. Let's see what's inside for each version.

Python 3.5.4rc1

Python 3.5.4 will be the last "bugfixes" release of 3.5. After 3.5.4 final is released, 3.5 will enter "security fixes only" mode, and as such the only improvements made in the 3.5 branch will be security fixes.

Features and changes:

  • improved Python zip application support
  • additional unpacking generalizations
  • "%-formatting" for bytes and bytearray objects
  • a new operator (@) for matrix multiplication
  • os.scandir(), a fast new directory traversal function
  • adding support for automatic retries of interrupted system calls
  • change StopIteration handling inside generators
  • the typing module, a new standard for type annotations
  • math.isclose(), a function for testing approximate equality
  • making the Windows Python launcher aware of virtual environments
  • eliminating .pyo files
  •  a new and improved mechanism for loading extension modules
  • coroutines with async and await syntax

Python 3.4.7rc1

Python 3.4 has now entered "security fixes only" mode, and as such the only improvements between Python 3.4.6 and Python 3.4.7 are security fixes. Also, Python 3.4.7 has only been released in source code form; no more official binary installers will be produced.

Features and changes:

Python 3.4 includes a range of improvements of the 3.x series, including hundreds of small improvements and bug fixes. Among the new major new features and changes in the 3.4 release series are:

  • "pathlib" module providing object-oriented filesystem paths
  • a standardized "enum" module
  • a build enhancement that will help generate introspection information for builtins
  • improved semantics for object finalization
  • adding single-dispatch generic functions to the standard library
  • a new C API for implementing custom memory allocators
  • changing file descriptors to not be inherited by default in subprocesses
  • a new "statistics" module
  • standardizing module metadata for Python's module import system
  • a bundled installer for the pip package manager
  • a new "tracemalloc" module for tracing Python memory allocations
  • a new hash algorithm for Python strings and binary data
  • a new and improved protocol for pickled objects
  • a new "asyncio" module, a new framework for asynchronous I/O

You can learn more about 3.4.7rc1 and 3.5.4rc1.


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.