New submission from wim glenn <wim.gl...@gmail.com>:

Could cases like these be made to work? *Should* cases like these be made to 
work?

L = [0, 1, 2]
L[::2], *rest = "abcdef"
# ValueError: attempt to assign sequence of size 1 to extended slice of size 2

a, L[::2] = "abc"
# ValueError: too many values to unpack (expected 2)

The list slice knows exactly how many slots need to be filled, so I can't 
immediately think of any obvious ambiguity. Maybe there are some implementation 
complications with supporting e.g. generators on the RHS (because RHS must be 
evaluated before LHS - 
https://docs.python.org/3/reference/expressions.html#evaluation-order).

----------
components: Interpreter Core
messages: 341160
nosy: wim.glenn
priority: normal
severity: normal
status: open
title: Extended slice assignment + iterable unpacking
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to