[issue17939] Misleading information about slice assignment in docs

Terry J. Reedy report at bugs.python.org
Fri May 10 21:45:39 CEST 2013


Terry J. Reedy added the comment:

Since range objects have a known length, that example is not enough to show 'any iterable'. However, generators do not even have a __length_hint__ and they work too.

a = [1,2,3]
a[0:1] = (i for i in range(4))
print(a)
>>> 
[0, 1, 2, 3, 2, 3]

----------
nosy: +terry.reedy

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17939>
_______________________________________


More information about the Python-bugs-list mailing list