Re: s[i:j:t] = t stipulation

2007-11-21 Thread Terry Reedy
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | On 2007-11-20, Terry Reedy <[EMAIL PROTECTED]> wrote: | > No, it should be defined as resulting in | > | > ['a', 1, 'a', 2, 'a', 3, None, 5, None, 7, None, 9] # ;-) Note smiley. | I thought deletion of elements would b

Re: s[i:j:t] = t stipulation

2007-11-21 Thread Neil Cerutti
On 2007-11-20, Terry Reedy <[EMAIL PROTECTED]> wrote: > "Neil Cerutti" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >| s[i:j:t] = t (1) t must have the same length as the slice it is > replacing. > > This is essentially the same rule as requiring a proper length > of t for > > a,

Re: s[i:j:t] = t stipulation

2007-11-20 Thread Terry Reedy
"Neil Cerutti" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | s[i:j:t] = t (1) t must have the same length as the slice it is replacing. This is essentially the same rule as requiring a proper length of t for a,b,c = t # for whatever number of targets And people have made simil

s[i:j:t] = t stipulation

2007-11-20 Thread Neil Cerutti
s[i:j:t] = t (1) t must have the same length as the slice it is replacing. Why? >>> def foo(): ... while True: ... yield 'a' ... >>> foo() >>> x = range(10) >>> x[::2] = foo() This is infinite loop due to Python building a sequence out of the iterator to check its length. I think it migh