s[i:j:t] = t stipulation

Terry Reedy tjreedy at udel.edu
Wed Nov 21 16:30:25 EST 2007


"Neil Cerutti" <horpner at yahoo.com> wrote in message 
news:slrnfk8cd7.9o.horpner at FIAD06.norwich.edu...
| On 2007-11-20, Terry Reedy <tjreedy at udel.edu> 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 be more similar to slice
| assignment, e.g.:
|
| x[5:] = []
|  --> [0, 1, 2, 3, 4]
|  -/ /-> [0, 1, 2, 3, 4, None, None, None, None, None]
|
| > Or better yet, require the programmer to specify by modifying
| > either the target or source spec, as is done now.
|
| It seems a shame to accept iterators but to build a sequence out
| of them, if it can be avoided. But if there's too much confusion
| about what it should mean, I guess that kills the idea.

For the core, we agree.  For your personal use, completing
def repdel(museq, slise, source):
    "Replace or delete museq[slise] with items from source"
    ...
with the behavior you want should not be too difficult.

tjr






More information about the Python-list mailing list