[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-bugs-list
Subject:    [issue36761] Extended slice assignment + iterable unpacking
From:       wim glenn <report () bugs ! python ! org>
Date:       2019-04-30 18:48:02
Message-ID: 1556650082.38.0.163364239874.issue36761 () roundup ! psfhosted ! org
[Download RAW message or body]


New submission from wim glenn <wim.glenn@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 <report@bugs.python.org>
<https://bugs.python.org/issue36761>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/python-bugs-list%40marc.info



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic