Skip to content

bpo-32996: The bulk of What's New in Python 3.7 #6978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 20, 2018

Conversation

elprans
Copy link
Contributor

@elprans elprans commented May 18, 2018

This represents the bulk of the content for What's New in Python 3.7.

https://bugs.python.org/issue32996

This represents the bulk of the content for What's New in Python 3.7.
@1st1
Copy link
Member

1st1 commented May 18, 2018

I'll start reviewing this patch later today.

@1st1 1st1 self-assigned this May 18, 2018
@ned-deily
Copy link
Member

Thanks, @elprans! I'll be reviewing it this weekend as well.

@@ -78,9 +78,6 @@ options:

Providing both of the script selection options will trigger an exception.

.. versionchanged:: 3.7.0
The exit status is non-zero if the command fails.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, this was backported to 3.6 and 2.7.


Improved conistency of exceptions raised by :func:`issubclass` when called
with a non-class and an abstract base class as the first and second
arguments, respectively. (Contributed by Josh Bronson in :issue:`33018`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add a ref to optimizations section's paragraph that covers ABCMeta being rewritten in C.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the "conistency"

(Contributed by Yury Selivanov in :issue:`32251`.)

The new :func:`asyncio.get_running_loop` function returns the currently
running loop, or ``None`` if no loop is running. This is in contrast with
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be fixed: if no loop is running it raises a RuntimeError.

:meth:`Future.get_loop() <asyncio.Future.get_loop>` methods
return the instance of the loop on which a task or a future were created.
(Contributed by Yury Selivanov in :issue:`32415`.)
:meth:`Server.get_loop() <asyncio.Server.get_loop>` allows to do the same for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a new line here.

(Jelle Zijlstra with further improvements by INADA Naoki, Serhiy Storchaka,
and Raymond Hettinger in :issue:`28638`.)

Additionally, ``collections.namedtuple()`` now supports default values.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove "Additionally", feels a bit out of place.

The new :func:`sys.get_coroutine_origin_tracking_depth` function returns
the current coroutine origin tracking depth, as set by
the new :func:`sys.set_coroutine_origin_tracking_depth`.
(Contributed by Nathaniel J. Smith in :issue:`32591`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also mention here that asyncio now uses this new mechanism, and that this new API is intended to replace sys.set_coroutine_wrapper() API, which is, btw, deprecated in 3.7.


C API Changes
=============

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to mention PEP 567 related changes to the C API: https://www.python.org/dev/peps/pep-0567/#c-api

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These C APIs seem to be undocumented, BTW.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add an entry together with the documentation for PEP 567 C API in a separate PR.

dynamically as specified by :pep:`560`.
(Contributed by Ivan Levkivskyi in :issue:`32717`.)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some perf improvements in typing module due to PEP 560, I would probably mention 6-7x faster import of typing, but there are other perf improvements. They are all in the same PR #4906

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perf improvements should be in the "Optimizations" section.

ipaddress
---------

The new ``subnet_of`` and ``superset_of`` methods of
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this ought to be supernet_of rather than superset_of, yes?


:class:`~zipfile.ZipFile` now accepts the new *compresslevel* parameter to
control the compression level.
(Contributed by Stephen J. Turnbull. in :issue:`28102`.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This references the incorrect issue - it was actually 21417, and the attribution is also scrambled.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks for catching this.

@1st1
Copy link
Member

1st1 commented May 19, 2018

Also, I'd move PEP 545 description to the top of the document (where we have all other PEPs described).

@ned-deily It's a long weekend in Canada, so Elvis will be able to fix the comments here on Tuesday and I'll merge the PR.

Copy link
Member

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rendered the updated whatsnew in Sphinx and read through it in a browser. Looks good, modulo comments.

What a great Python release!

@@ -53,20 +55,123 @@ For full details, see the :ref:`changelog <changelog>`.
so it's worth checking back even after reading earlier versions.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this PR not the time to remove this "prerelease users" note yet?

that would act like a normal :meth:`__getattr__` method, except that it will
be defined on module *instances*.
Python 3.7 allows defining :meth:`__getattr__` on modules and will call
it whenever a module attribute is accessed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slightly misleading; like object __getattr__, module __getattr__ is called only if the attribute is otherwise not found. So it's not called "whenever a module attribute is accessed." Suggested re-word: "...and will call it whenever a module attribute is otherwise not found."

method now supports now supports passing a :term:`path-like objects <path-like object>`
as a socket path. (Contributed by Yury Selivanov in :issue:`32066`.)

The :func:`asyncio.windows_utils.socketpair`` function has been removed,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra backtick after windows_utils.socketpair

:func:`~contextlib.asynccontextmanager` and
:class:`~contextlib.AbstractAsyncContextManager` have been added. (Contributed
The new :func:`~contextlib.nullcontext` is a simpler and faster alternative
to :class:`~contextlib.ExitStack` for handling simple context managers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that "handling simple context managers" is an accurate description of what nullcontext is good for. It won't help you handle or implement a simple context manager, it's useful only as a no-op context managers. Suggested re-word: "... a simpler and faster no-op context manager than ExitStack."

Alexander Mohr and Ilya Kulakov in :issue:`29302`.)


cProfile
--------

:mod:`cProfile` command line now accepts ``-m module_name`` as an alternative
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for consistency with other entries, this sentence should start with "The ".

now accepts negative *limit*, truncating the result to the
``abs(limit)`` oldest frames. To get the old behaviour, use
the new *most_recent_first* argument to ``Traceback.format()``.
(Contributed by Jesse Bakker. in :issue:`32121`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove period after "Bakker"

@@ -837,6 +1630,13 @@ The initialization of the default warnings filters has changed as follows:
(Contributed by Nick Coghlan and Victor Stinner in :issue:`20361`,
:issue:`32043`, and :issue:`32230`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a period to end this sentence

avoid creating bound method instances.
(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)

The :mod:`asyncio` received a number of notable optimizations for commonly
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the word "module"

:meth:`dict.copy` is now up to 5.5 times faster.
(Contributed by Yury Selivanov in :issue:`31179`.)

:func:`hasattr` and :func:`getattr`` are now about 4 times faster when
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra backtick after getattr

The :meth:`~selectors.BaseSelector.modify` methods of classes
:class:`selectors.EpollSelector`, :class:`selectors.PollSelector`
and :class:`selectors.DevpollSelector` may be around 10% faster under
heavy loads. (Contributed by Giampaolo Rodola' in :issue:`30014`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use correct accent in contributor's name instead of trailing apostrophe?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how Giampaolo is spelling his name.

Copy link
Contributor

@willingc willingc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elprans Great work on the What's New. ☀️ I've left a few comments about typos and spelling.

an easy and consistent way to enter the Python debugger.

Built-in ``breakpoint()`` calls :func:`sys.breakpointhook`. By default, this
latter imports :mod:`pdb` and then calls ``pdb.set_trace()``, but by binding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

latter

Python 3.7 allows defining :meth:`__getattr__` on modules and will call
it whenever a module attribute is accessed.

A typical example of where this may be useful is attribute access deprecation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... attribute access, deprecation...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually means "deprecation warnings for attribute access". I'll reword for clarity.

provide nanosecond resolution: they return a number of nanoseconds as a Python
``int``.
The new functions are similar in function to the existing functions
without the ``_ns`` suffix, but instead of returning fractional seconds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...suffix. They differ by returning nanoseconds as integers, instead of fractional seconds.

abc
---

Improved conistency of exceptions raised by :func:`issubclass` when called
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sp./ consistency

the user intermix options and positional arguments on the command line,
as is possible in many unix commands. It supports most but not all
argparse features. (Contributed by paul.j3 in :issue:`14191`.)
The new :meth:`ArgumentParser.parse_intermixed_args() \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As done on line 589, it probably is more readable to avoid using \ and put the method link all on one line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is just the backslash that worries you, perhaps you can remove it but leave the line break in


Support for directly ``await``-ing instances of :class:`asyncio.Lock` and
other asyncio synchronization primitives has been deprecated. An
asynchronous context manager has to be used in order to acquire and release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has to must

The new :func:`gc.freeze`` function allows freezing all objects tracked
by the garbage collector and exclude them from future collections.
This can be used before a POSIX ``fork()`` call to make the GC copy-on-write
friendly or to speed up collection. The new :func:`gc.unfreeze` functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there is an extra period before "The new..."

===========================================

Function :c:func:`PySlice_GetIndicesEx` is deprecated and replaced with
a macro if ``Py_LIMITED_API`` is not set or set to the value between
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... is not set, is set to a value in the range between 0x03050400 and 0x03060000 (not inclusive), or is 0x03060100 or higher.


* Direct instantiation of :class:`ssl.SSLSocket` and :class:`ssl.SSLObject`
objects is now prohibited. The constructors were never documented, tested,
or designed as public constructors. Users were suppose to use
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sp. supposed


* ``repr`` for :exc:`BaseException` has changed not to include trailing comma
in the output. Mind that most exceptions are affected by this change.
* ``repr`` for :exc:`BaseException` has changed not to include the trailing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has changed not to include has changed to exclude

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A have reviewed a small part of the PR and have many comments. Many changes should be in other sections, more brief, or not be added at all.

abc
---

Improved conistency of exceptions raised by :func:`issubclass` when called
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is not worth an entry in this section. If you with, it can be added in the section "Other Language Changes" or like.

aifc
----

Improved exceptions raised for invalid number of channels and sample
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is not worth be mentioned in this document at all.

intermixing options and positional arguments.
(Contributed by paul.j3 in :issue:`14191`.)

:mod:`argparse` subparsers are now required by default. This matches the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will better look in the section "Changes in the Python API".

ast
---

:meth:`ast.literal_eval()` is now more strict. Addition and subtraction of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will better look in the section "Changes in the Python API". But I'm not sure it is worth mentioning in this document at all. This change makes the implementation closer to the documentation and will affect too little code that use literal_eval() in non-purposed way.

asyncio
-------

The new :term:`provisional <provisional api>` :func:`asyncio.run` function can
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very long list. It would be better to write it in more compact form. See how long list of functions were introduced in previous releases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, asyncio always have a lot of stuff in what's new. Every change here is important, please keep the section as is.

dictionary are now being implicitly converted to strings.
(Contributed by James Tocknell. in :issue:`23835`.)

The *filename* parameter of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this section.

csv
---

A single empty field is now always quoted when written into a CSV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this section.

dbm
---

:func:`dbm.dumb` now supports reading read-only files and no longer writes the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this section. This should be in two sections: a part in minor enhancements, and a part in deprecations.

:mod:`dbm.dumb` instead of :func:`dbm.dumb`.

(Contributed by Serhiy Storchaka in :issue:`28847`.)


:func:`dbm.open` now encodes filenames using the filesystem encoding rather
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix.

the new *depth* parameter.
(Contributed by Serhiy Storchaka in :issue:`11822`.)

Functions in the :mod:`dis` module now works with asynchronous generators and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in this section.

(Contributed by Paul Ganssle in :issue:`15873`.)

The :class:`tzinfo <datetime.tzinfo>` objects now supprt sub-minute offsets.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be more correct to say “The tzinfo class now supports . . .”, unless there are only specific instances with the support.

:meth:`Future.get_loop() <asyncio.Future.get_loop>` methods
return the instance of the loop on which a task or a future were created.
(Contributed by Yury Selivanov in :issue:`32415`.)
:meth:`Server.get_loop() <asyncio.Server.get_loop>` allows to do the same for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know allows to is awkward and incorrect grammar in English, though it crops up often. In this case I suggest something like “Server.get_loop allows doing the same . . .”, or even “Server.get_loop does the same”.

---

A single empty field is now always quoted when written into a CSV
file. This allows to distinguish an empty row from a row consisting of
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This allows distinguishing . . .

--

The new :func:`gc.freeze`` function allows freezing all objects tracked
by the garbage collector and exclude them from future collections.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. . . and excluding them . . .

The improved host name check requires an OpenSSL 1.0.2 or 1.1 compatible
libssl. OpenSSL 0.9.8 and 1.0.1 are no longer supported. LibreSSL is
The improved host name check requires OpenSSL 1.0.2 or 1.1 compatible
libssl. OpenSSL 0.9.8 and 1.0.1 are no longer supported. LibreSSL is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense with “an” than without. Another way of writing it could be “. . . requires a libssl implementation compatible with Open SSL’s 1.0.2 or 1.1 APIs.”

But after reading further down, it says one of these versions is required to build (and presumably use) the SSL module in general. Which seems to make this paragraph redundant.

:func:`timeit.timeit` autorange now uses a single loop iteration if
the benchmark takes less than 10 seconds, instead of 10 iterations.
``python3 -m timeit -s 'import time' 'time.sleep(1)'`` now takes 4 seconds
instead of 40 seconds.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This rule doesn’t make sense. Maybe it should be to use a single iteration if a benchmark is slower than some value (0.2 s?). Does running sleep(11) also do a single iteration?

method can be used to replace the logger stream after handler creation.
(Contributed by Vinay Sajip in :issue:`30522`.)

It is now possible to specify keyword arguments to handler constructor in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this should say handler constructors?


The :func:`math.erf` and :func:`math.erfc` functions now use the (faster)
C library implementation on most platforms.
(Contributed by Serhiy Storchaka in :issue:`26121`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate entry, although I prefer your version :)

* Due to internal changes in :mod:`socket` you won't be able to
:func:`socket.fromshare` a socket :func:`~socket.socket.share`-ed in older
Python versions.
* Due to internal changes in :mod:`socket` calling :func:`socket.fromshare`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a comma: “Due to changes in socket, calling fromshare . . .”

@1st1
Copy link
Member

1st1 commented May 19, 2018

@serhiy-storchaka @ned-deily Serhiy, I disagree with how you want to rewrite the asyncio section. As asyncio maintainer I like the what's new in 3.7 asyncio section, and find it similar in its size to 3.6 and 3.5. A lot of changes that you marked as "not in this section" or "not worth mentioning" are actually very subtle and must be communicated to asyncio users. I'm +1 to drop docs for aifc modules and alike as you suggested, but the asyncio section should stay as is in my opinion.

@ned-deily
Copy link
Member

@1st1 @serhiy-storchaka Regarding the asyncio section, in general I think the level of detail is OK. There are a few entries that perhaps could be shortened a bit and the section would benefit by turning the items into a bullet list as was done in the 3.6 docs. I think it's better to have too much detail here than too little. Let's go with @1st1's instincts and see how it all looks after @elprans does further editing. We can always remove or add stuff later if necessary.

@serhiy-storchaka
Copy link
Member

If other core developer (especially the maintainer of the module) want to include some information I have no objections.

@elprans
Copy link
Contributor Author

elprans commented May 19, 2018

Thanks everyone for the reviews! I updated the PR with fixes.

equivalent to CR.
(Contributed by Bo Bayles in :issue:`32304`.)

The unused ``install_misc`` command has been removed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the "Removed" section.

and ``platforms`` fields are not specified as a list or a string.
(Contributed by Berker Peksag in :issue:`19610`.)

The ``upload`` command no longer tries to change CR end-of-line characters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix.


:class:`distutils.core.setup` now warns if the ``classifiers``, ``keywords``
and ``platforms`` fields are not specified as a list or a string.
(Contributed by Berker Peksag in :issue:`19610`.)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and Neil Schemenauer

therefore included in source distributions.
(Contributed by Ryan Gonzalez in :issue:`11913`.)

:class:`distutils.core.setup` now warns if the ``classifiers``, ``keywords``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "Changes in the Python API".

enum members.
(Contributed by Ethan Furman in :issue:`31801`.)

In Python 3.8, attempting to check for non-Enum objects in :class:`Enum`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In "Deprecated"

@@ -652,103 +1288,189 @@ can be set within the scope of a group.
``'^$'`` or ``(?=-)`` that matches an empty string.
(Contributed by Serhiy Storchaka in :issue:`25054`.)

Regular expressions compiled with the :const:`re.LOCALE` flag no longer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changes in the Python API"

when the compiled regular expression is used.
(Contributed by Serhiy Storchaka in :issue:`30215`.)

:exc:`FutureWarning` is now emitted if a regular expression contains
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Changes in the Python API".

timeit
------

:func:`timeit.timeit` autorange now uses a single loop iteration if
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually many other changes were made in this issue.

types
-----

The new :class:`~types.WrapperDescriptorType`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge the following two entries into a single paragraph.

dynamically as specified by :pep:`560`.
(Contributed by Ivan Levkivskyi in :issue:`32717`.)


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perf improvements should be in the "Optimizations" section.


:class:`~zipfile.ZipFile` now accepts the new *compresslevel* parameter to
control the compression level.
(Contributed by Bo Bayle in :issue:`21417`.)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, looks like my last name is misspelled here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. Will fix.

@elprans
Copy link
Contributor Author

elprans commented May 19, 2018

@serhiy-storchaka I agree that placing depreciations and removals together makes sense, but what is the value in splitting standard library improvements into “New” and “Changed”?



binascii
--------

The :func:`~binascii.b2a_uu` function now accepts an optional *backtick*
keyword argument. When it's true, zeros are represented by ``'`'``
keyword argument. When it's ``True``, zeros are represented by ``'`'``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep "true". Any boolean true value switches on this feature, not just literal True.

It is common to write "if is true" for input arguments, but "return True" for output value.

* The unused :mod:`distutils ```install_misc`` command has been removed.
(Contributed by Eric N. Vander Weele in :issue:`29218`.)

* The ``fpectl`` module has been removed. It was never enabled by
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth to add a separate section for this. Seems this is the first module removal since 3.0.

C library implementation on most platforms.
(Contributed by Serhiy Storchaka in :issue:`26121`.)

Many functions and methods in the :mod:`abc` module have been reimplemented
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change are already documented above.

(Contributed by Jelle Zijlstra with further improvements by INADA Naoki,
Serhiy Storchaka, and Raymond Hettinger in :issue:`28638`.)

:meth:`date.fromordinal` and :meth:`date.fromtimestamp` are now up to
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest: Alternate :class:`datetime.date` constructors :meth:`~datetime.date.fromordinal` and :meth:`~datetime.date.fromtimestamp` ...


* Trace hooks may now opt in to receiving ``opcode`` events from the interpreter
by setting the new ``f_trace_opcodes`` attribute to :const:`True` on the frame
* Trace hooks may now opt out of receiving the ``line`` and ``opcode`` events
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"line" may now be opted out, but "opcode" may now be opted in.

- Using non-integer value for selecting a plural form in :mod:`gettext` is
now deprecated. It never correctly worked. (Contributed by Serhiy Storchaka
in :issue:`28692`.)
aifc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth to add separate subsections for modules? Most contain only a single entry. This makes the text less compact.

@@ -1157,6 +2077,13 @@ Changes in Python behavior
exceptions.
(Contributed by Yury Selivanov in :issue:`32670`.)

* :keyword:`async` and :keyword:`await` names are now reserved keywords.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this at the first place, as it is the most visible breaking change. Would be nice to add recommendations for solving problems caused by this change.

@@ -1214,7 +2137,7 @@ Changes in the Python API
(Contributed by Serhiy Storchaka in :issue:`29192`.)

* ``Module``, ``FunctionDef``, ``AsyncFunctionDef``, and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to move this entry to the beginning of the sections, as it breaks several third-party projects.

@@ -1289,6 +2213,10 @@ Changes in the Python API
of escaping all characters other than ASCII letters, numbers, and ``'_'``.
(Contributed by Serhiy Storchaka in :issue:`29995`.)

* :func:`os.listdir` and :func:`os.scandir` now emit file name as bytes when
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix.

dictionary are now being implicitly converted to strings.
(Contributed by James Tocknell in :issue:`23835`.)

* :mod:`csv` will now always quote empty fields. This allows distinguishing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bug fix.

@serhiy-storchaka
Copy link
Member

New things can not break you code. Changed things can break the code that depends on the old behavior. Sometimes the boundary is not well determined.

Remove redundant content, reclassify some entries, fix typos and address
other review feedback.
@elprans
Copy link
Contributor Author

elprans commented May 20, 2018

Changed things can break the code

Yes, and this is why we have the "Porting to Python 3.7" section, which begins with:

"This section lists previously described changes and other bugfixes
that may require changes to your code."

(emphasis mine)

I think optimizing the What's New document for readability is more important than trying to make it short. Thus, repeating change descriptions in different sections is OK.

@1st1 1st1 merged commit 63536bd into python:master May 20, 2018
@miss-islington
Copy link
Contributor

Thanks @elprans for the PR, and @1st1 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @elprans and @1st1, I could not cleanly backport this to 3.7 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 63536bd286097e770909052052a21804a5e09b66 3.7

@1st1
Copy link
Member

1st1 commented May 20, 2018

The PR is merged now. All edits and suggestions will be addressed in separate PRs. Thanks, Elvis!

elprans added a commit to elprans/cpython that referenced this pull request May 20, 2018
(cherry picked from commit 63536bd)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
@bedevere-bot
Copy link

GH-6998 is a backport of this pull request to the 3.7 branch.

1st1 pushed a commit that referenced this pull request May 20, 2018
…6998)

(cherry picked from commit 63536bd)

Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.