Skip to content

Conversation

@rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Aug 5, 2019

Work in progress. Please add suggestions here as you find them.

https://bugs.python.org/issue37759

@rhettinger rhettinger added docs Documentation in the Doc dir needs backport to 3.8 labels Aug 5, 2019
@rhettinger rhettinger changed the title Better whatsnew bpo-37759: Significant edits to Whatsnew 3.8 Aug 5, 2019
if (clean_name := normalize('NFC', name)) in allowed_names]

Try to limit use of the walrus operator to clean cases that reduce
complexity and improve readability. When combined with other features
Copy link
Member

Choose a reason for hiding this comment

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

I would stop at "readability." I don't think specific examples of what's not okay help the readers of this document.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

At some point, we should put in some PEP 8 guidance. I've been using the beta with customers and students for the last several weeks. These examples were typical.

Copy link
Member

@ericvsmith ericvsmith left a comment

Choose a reason for hiding this comment

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

This looks great to me. Thanks for your work on this, Raymond!

inverse for other negative exponents. For example, to compute the
`modular multiplicative inverse
<https://en.wikipedia.org/wiki/Modular_multiplicative_inverse>`_ of 38
in modulo 137, write::
Copy link
Contributor

Choose a reason for hiding this comment

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

"in modulo 137" should be "modulo 37".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped the "in". Kept the 137.

``pow(x=2, y=10)`` and ``pow(2, 10, z=17)`` are invalid.
len(obj='hello') # The "obj" keyword argument impairs readability

A further benefit of marking a parameter as positional-only is that it
Copy link
Member

@pablogsal pablogsal Aug 5, 2019

Choose a reason for hiding this comment

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

I find this section very well structured and informative! This rewrite really makes a difference :) What do you think about adding to this paragraph also the case of going from one argument to *args without breaking client code. For example going from

def add_to_queue(item):
   ...

to

def add_to_queue(*items):
   ...

@tirkarthi
Copy link
Member

With respect to unittest module. It now has the ability to collect async functions where before 3.8 tests have to be a normal function that could have an async definition inside and uses asyncio.run or loop to run it. This was not mentioned in whatsnew. Maybe a good addition given it improves testing asyncio code. Relevant commit : 4dd3e3f

import asyncio
import unittest

from unittest.async_case import IsolatedAsyncioTestCase

class FooTest(IsolatedAsyncioTestCase):

    async def asyncSetUp(self):
        print("Async Setup")

    async def test_sleep(self):
        await asyncio.sleep(1)
        self.assertEqual(1, 1)

    async def asyncTearDown(self):
        print("Async Teardown")

if __name__ == "__main__":
    unittest.main()
./python.exe /tmp/foo.py
Async Setup
Async Teardown
.
----------------------------------------------------------------------
Ran 1 test in 1.028s

OK

Thanks for improving the changelog examples.

@rhettinger
Copy link
Contributor Author

tirkarthi , thanks for the suggestions. I'll add the unittest example to the next round of updates (I'm making multiple PRs to minimize merge conflicts).

@rhettinger rhettinger merged commit 4f9ffc9 into python:master Aug 5, 2019
@miss-islington
Copy link
Contributor

Thanks @rhettinger for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 5, 2019
(cherry picked from commit 4f9ffc9)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
@bedevere-bot
Copy link

GH-15139 is a backport of this pull request to the 3.8 branch.

rhettinger added a commit that referenced this pull request Aug 5, 2019
…15139)

(cherry picked from commit 4f9ffc9)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
websurfer5 pushed a commit to websurfer5/cpython that referenced this pull request Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants