From 8576d00ce880b2079139e5bfaa760571b200d534 Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Fri, 2 Aug 2019 14:48:06 -0400 Subject: [PATCH] Implement HySequence with tuples instead of lists --- hy/models.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hy/models.py b/hy/models.py index fbced02..56160df 100644 --- a/hy/models.py +++ b/hy/models.py @@ -243,7 +243,7 @@ class HyComplex(HyObject, complex): _wrappers[complex] = HyComplex -class HySequence(HyObject, list): +class HySequence(HyObject, tuple): """ An abstract type for sequence-like models to inherit from. """ @@ -256,7 +256,8 @@ class HySequence(HyObject, list): return self 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): return self.__class__(super(HySequence, self).__getslice__(start, end))