From e5461f171c0c4e4f10123d6af75b16c2d15aaf0c Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Sun, 18 Aug 2019 09:45:40 -0400 Subject: [PATCH] Update NEWS and documentation --- NEWS.rst | 6 ++++++ docs/language/internals.rst | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/NEWS.rst b/NEWS.rst index 36a681e..6e5c8ff 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -16,6 +16,12 @@ New Features * All augmented assignment operators (except `%=` and `^=`) now allow more than two arguments. +Other Breaking Changes +------------------------------ +* ``HySequence`` is now a subclass of ``tuple`` instead of ``list``. + Thus, a ``HyList`` will never be equal to a ``list``, and you can't + use ``.append``, ``.pop``, etc. on an expression or list. + Bug Fixes ------------------------------ * Statements in the second argument of `assert` are now executed. diff --git a/docs/language/internals.rst b/docs/language/internals.rst index a89b356..2fb29bc 100644 --- a/docs/language/internals.rst +++ b/docs/language/internals.rst @@ -60,6 +60,10 @@ Adding a HySequence to another iterable object reuses the class of the left-hand-side object, a useful behavior when you want to concatenate Hy objects in a macro, for instance. +HySequences are (mostly) immutable: you can't add, modify, or remove +elements. You can still append to a variable containing a HySequence with +``+=`` and otherwise construct new HySequences out of old ones. + .. _hylist: @@ -90,11 +94,6 @@ HyDict ``hy.models.HyDict`` inherits :ref:`HySequence` for curly-bracketed ``{}`` expressions, which compile down to a Python dictionary literal. -The decision of using a list instead of a dict as the base class for -``HyDict`` allows easier manipulation of dicts in macros, with the added -benefit of allowing compound expressions as dict keys (as, for instance, -the :ref:`HyExpression` Python class isn't hashable). - Atomic Models -------------