[New-bugs-announce] [issue34427] calling MutableSequence.extend on self produces infinite loop

Naris R report at bugs.python.org
Sat Aug 18 05:58:31 EDT 2018


New submission from Naris R <nariscatboy at gmail.com>:

Example:

```
from typing import MutableSequence, TypeVar

CliffordGate = TypeVar('CliffordGate')

class QCircuit(MutableSequence[CliffordGate]):
    def __init__(self, gates):
        self.gates = list(gates)

    def __repr__(self):
        return f'{self.__class__.__name__}({self.gates})'
   
    def __getitem__(self, key):
        return self.gates[key]

    def __setitem__(self, key, item):
        self.gates[key] = item

    def __delitem__(self, key):
        del self.gates[key]

    def insert(self, key, item):
        self.gates.insert(key, item)

a = QCircuit(['H0', 'S2'])
a += a
```

----------
components: Library (Lib)
messages: 323696
nosy: Naris R
priority: normal
severity: normal
status: open
title: calling MutableSequence.extend on self produces infinite loop
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34427>
_______________________________________


More information about the New-bugs-announce mailing list