[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread Julien Palard


Change by Julien Palard :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread Julien Palard


Julien Palard  added the comment:


New changeset d0ebbf4895439233c8398dbdd0456d07132b2a6f by Julien Palard (Miss 
Islington (bot)) in branch '3.6':
bpo-33878: Doc: Fix missing case by simplifying. (GH-7762)
https://github.com/python/cpython/commit/d0ebbf4895439233c8398dbdd0456d07132b2a6f


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread Julien Palard


Julien Palard  added the comment:


New changeset aa493b5c18463ab45c087564e287643606f004ca by Julien Palard (Miss 
Islington (bot)) in branch '3.7':
bpo-33878: Doc: Fix missing case by simplifying. (GH-7762)
https://github.com/python/cpython/commit/aa493b5c18463ab45c087564e287643606f004ca


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9744

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread miss-islington


Change by miss-islington :


--
pull_requests: +9743

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-11 Thread Julien Palard


Julien Palard  added the comment:


New changeset 082875dcd6d482558e5f1da97a1c801d60b3ed5b by Julien Palard in 
branch 'master':
bpo-33878: Doc: Fix missing case by simplifying. (GH-7762)
https://github.com/python/cpython/commit/082875dcd6d482558e5f1da97a1c801d60b3ed5b


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-10 Thread Emily Morehouse


Change by Emily Morehouse :


--
nosy: +emilyemorehouse

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +9719

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-09 Thread Guido van Rossum


Guido van Rossum  added the comment:

I would like to see this fixed.

On Fri, Nov 9, 2018 at 4:27 AM Serhiy Storchaka 
wrote:

>
> Serhiy Storchaka  added the comment:
>
> I think that the fact that `(a) = 42` is accepted is rather an
> implementation detail, and the consequence of limitations of the grammar
> parser. It accepts arbitrary expression at the left hand side of
> assignment. After transforming CST to AST unsuitable targets are rejected,
> but information about grouping parenthesis is lost at this stage.
>
> This can be fixed if check the left hand side node before converting to
> AST.
>
> --
> nosy: +gvanrossum, serhiy.storchaka
>
> ___
> Python tracker 
> 
> ___
>
-- 
--Guido (mobile)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-11-09 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that the fact that `(a) = 42` is accepted is rather an implementation 
detail, and the consequence of limitations of the grammar parser. It accepts 
arbitrary expression at the left hand side of assignment. After transforming 
CST to AST unsuitable targets are rejected, but information about grouping 
parenthesis is lost at this stage.

This can be fixed if check the left hand side node before converting to AST.

--
nosy: +gvanrossum, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-06-17 Thread Julien Palard


Change by Julien Palard :


--
keywords: +patch
pull_requests: +7370
stage:  -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-06-16 Thread Martin Panter

Martin Panter  added the comment:

I think it is okay to leave out the options for the unpacking case. But I think 
it is worth clarifying that the single-target case also applies without 
parentheses, but that it doesn’t apply if there is a trailing comma. So:

‘‘‘
If the target list is a single target with no trailing comma, optionally in 
parentheses, the object is assigned to that target.

Else the object must be an iterable . . .
’’’

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-06-16 Thread Julien Palard


Julien Palard  added the comment:

Agree, the empty list could be merged, the only special-case is the "single 
item in parenthesis", as always.

I'm still exploring the path to simplicity over explicitly listing everything 
(but in the reference, explicitly listing could be what we need):

Assignment of an object to a target list, optionally enclosed in 
parentheses or square brackets, is recursively defined as follows.

If the target list is a single target in parentheses: The object is 
assigned to that target.
Else the object must be an iterable with the same number of items as 
there are targets in the target list, and the items are assigned, from left to 
right, to the corresponding targets.

What do you think? Should we go full-explicit, with trailing comas and 
everything?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-06-16 Thread Martin Panter


Martin Panter  added the comment:

I think I intended the third option to include all comma-separated lists, 
including:

a, b, c = x  # No brackets
(a, b, c) = x  # Round brackets
[a, b, c] = x  # Square brackets
a, = x  # Single target with comma

Perhaps something like this would be clearer:

* If the target list is
* a comma-separated list of targets, with or without brackets, or
* a single target with a trailing comma, with or without brackets, or
* a single target in square brackets,
  the object must be . . .

The empty target list case could also be merged. Then the only differentiation 
is between a single target (no comma, optional round brackets) and iterable 
unpacking.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue33878] Doc: Assignment statement to tuple or list: case missing.

2018-06-16 Thread Julien Palard


New submission from Julien Palard :

In [1] I read:

> If the target list is a comma-separated list of targets, or a single target 
> in square brackets

This come from https://bugs.python.org/issue23275 (patch is [2]).

I suspect there's a missing case "list of targets in square brackets" (and to 
be pedantic "list of targets in parenthesis").

The specialized documentation about single-valued targets in sequence-like 
construction come from this difference:

>>> (a) = 42
>>> a
42

>>> [a] = [42]
>>> a
42


which is correctly described the line before:

> If the target list is a single target in parentheses: The object is assigned 
> to that target.

So the correct way to state it may be:

> Else the object must be an iterable with the same number of items as there 
> are targets in the target list, and the items are assigned, from left to 
> right, to the corresponding targets.

The `Else`, coupled with the existing "Assignment of an object to a target 
list, optionally enclosed in parentheses or square brackets" covers properly 
the cases:

- Multiple target separated by comas (already covered)
- Multiple target enclosed by parenthesis and brackets (not covered)
- Single target enclosed by angle brackets (already covered)


[1]: 
https://docs.python.org/3.7/reference/simple_stmts.html#assignment-statements
[2]: https://bugs.python.org/file42878/issue23275_v4.diff

--
assignee: docs@python
components: Documentation
messages: 319735
nosy: docs@python, martin.panter, mdk
priority: normal
severity: normal
status: open
title: Doc: Assignment statement to tuple or list: case missing.
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com