On Mon, Oct 19, 2020 at 3:11 PM Thomas Wouters <tho...@python.org> wrote:

> PEP: 640
> Title: Unused variable syntax
> Author: Thomas Wouters <tho...@python.org>
>
...

> In Python it is somewhat common to need to do an assignment without
> actually
> needing the result. Conventionally, people use either ``"_"`` or a name
> such
> as ``"unused"`` (or with ``"unused"`` as a prefix) for this. It's most
> common in *unpacking assignments*::
>

Many times I'm not using an assignment target, I still like to give a
descriptive name.  The reason is that it lets me see what value I'm not
using. It helps to document and confirm my understanding of the value being
unpacked. It also lets you toggle easily between using and not using a
value if you're working on the code.

To illustrate, I might do this--

    scheme, _netloc, _path, params, query, fragment = urlparse(url)

instead of this--

    scheme, _, _, params, query, fragment = urlparse(url)

So I'd prefer if the scheme would allow including a name (either by
prefixing or some other method), or at least not preclude such an extension
in the future.

--Chris
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/IMU3N7YIFVBNAXWSWQ2BMXJUPNEZWCI7/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to