Implement HySequence with tuples instead of lists
This commit is contained in:
parent
52c0e4e221
commit
8576d00ce8
@ -243,7 +243,7 @@ class HyComplex(HyObject, complex):
|
|||||||
_wrappers[complex] = HyComplex
|
_wrappers[complex] = HyComplex
|
||||||
|
|
||||||
|
|
||||||
class HySequence(HyObject, list):
|
class HySequence(HyObject, tuple):
|
||||||
"""
|
"""
|
||||||
An abstract type for sequence-like models to inherit from.
|
An abstract type for sequence-like models to inherit from.
|
||||||
"""
|
"""
|
||||||
@ -256,7 +256,8 @@ class HySequence(HyObject, list):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
def __add__(self, other):
|
def __add__(self, other):
|
||||||
return self.__class__(super(HySequence, self).__add__(other))
|
return self.__class__(super(HySequence, self).__add__(
|
||||||
|
tuple(other) if isinstance(other, list) else other))
|
||||||
|
|
||||||
def __getslice__(self, start, end):
|
def __getslice__(self, start, end):
|
||||||
return self.__class__(super(HySequence, self).__getslice__(start, end))
|
return self.__class__(super(HySequence, self).__getslice__(start, end))
|
||||||
|
Loading…
Reference in New Issue
Block a user