Question: ```
>>> a=range(5)
>>> [a[i] for i in range(0,len(a),2)] ## list comprehension for side effects
[0, 2, 4]
>>> a
[0, 1, 2, 3, 4]
>>> [a[i]=3 for i in range(0,len(a),2)] ## try to do assignment
SyntaxError: invalid syntax
>>> def setitem(listtochange,n,value):  ## function to overcome limitation
    listtochange[n]=value
    return value

>>> [setitem(a,i,'x') for i in range(0,len(a),2)] ## proving the function
['x', 'x', 'x']
>>> a 
['x', 1, 'x', 3, 'x']   # We did assignment anyway

```

Answer: 
Don't use list comprehensions to perform side-effects - that is not Pythonic. Use an explicit loop instead:

```
for i in range(0,len(a),2):
    a[i] = 3

```

Apart the side-effects in list comprehensions being surprising and unexpected, you are constructing a result list that you never use which is wasteful and completely unnecessary here.
You can also use `list.__setitem__`

```
a = range(5)
[a.__setitem__(i,"x") for i in range(0,len(a),2)]

```

Or if you want to avoid the contruction of an intermediate list:

```
any(a.__setitem__(i,"x") for i in range(0,len(a),2))

```

But assignment in list comprehensions is indeed unpythonic.