New features planned for Python 4.0

With the release of Python 3.8 coming soon, the core development team has asked
me to summarize our latest discussions on the new features planned for Python
4.0, codename “ouroboros: the snake will eat itself”.

This will be an exciting release and a significant milestone, many thanks
to the hard work of over 100 contributors.

  • After heated debate on the mailing list, the 79-character line limit
    prescribed by PEP8 will be updated. IDE users all over the world will now be
    able to take advantage of their 30″ ultra-wide 4K monitors, as the
    recommended line length will be increased to 89.5 characters (this was a
    compromise with the 100-character lobby, the decision being to split the
    difference).
  • All new libraries and standard lib modules must include the phrase “for
    humans” somewhere in their title.
  • Finally, a new string-type for the masses, Python 4.0 will feature
    “z-strings”: C-style NULL terminated bytestrings. Just prefix your string like so, z'my string' and Python will automatically ensure it is
    NULL-terminated. Note: the new z-strings cannot be used with any of the
    existing APIs that take string arguments – they must first be decoded to
    unicode strings or cast to bytes.
  • Type-hinting has been extended to provide even fewer tangible benefits. This new and
    “nerfed” type hinting will be called type whispering.
  • Fuck it we’re going to just vendor libuv to provide the event loop for
    Twisted asyncio.
  • You can now use the async keyword before every single other keyword in the
    Python language, and we encourage you to async do so. There’s nothing wrong with cargo-culting some magic keywords all over the place — you want to go fast, don’t you?
  • In addition to namedtuple and dataclasses (3.7), Python 4.0 will include
    several new thousand line decorator-hacks to implement simple struct types.
  • The GIL has been removed.
  • Just kidding! Instead we’ve been focusing all our effort on making it easier
    to juggle multiple interpreter data-structures within a single thread. No,
    no, you can thank us later!
  • The bytes-vs-str thing kept many of us employed as we had convinced our companies they needed to upgrade to Python 3. In the same spirit, we are excited to announce that there will now be two int types — int will be a 32-bit signed integer, and long will be a 64-bit signed integer. But before you say, “hey, they did that in Python 2!”, we’d like to add that you can no longer use int anywhere, and will need to convert them all to long.
  • Based on the overwhelming success of the 2to3 utility, we plan to release a
    3to4 tool that will automatically convert your code to utilize these
    exciting new features.

With much sadness, the following features did not make
the cut:

  • After attempting to rewrite portions of the interpreter with Rust, nobody
    could figure out how to disable the borrow-checker, so we gave up.
  • No switch statement (and yes, yes, I know you can use
    a dict to do dispatching).
  • concurrent.Pasts and concurrent.Present will not be merged in time for
    this release, but hey, we’ve got futures, haven’t we?
  • Since nobody understands how twisted asyncio works, we are unable to offer any improvements at this time. The PSF now recommends all new projects to use gevent.
  • Unfortunately we will not be able to offer any improvements to the packaging “situation”.

We look forward to this release, and will do everything in our power to ensure
it takes us several minor versions before it is even remotely usable.

Take heart! Remember the python motto:

What is dead can never die

photos/deadsnakes.png

Don’t worry, all these snakes were already on death row.

Original Source

Leave a comment