From 88c0f92810d062680ab26e7493f8eb2310a3530b Mon Sep 17 00:00:00 2001 From: Kodi Arfer Date: Thu, 1 Aug 2019 13:35:24 -0400 Subject: [PATCH] Clean up string handling in _compile_assign --- hy/compiler.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hy/compiler.py b/hy/compiler.py index 34a9dd5..7b48822 100755 --- a/hy/compiler.py +++ b/hy/compiler.py @@ -1345,17 +1345,16 @@ class HyASTCompiler(object): def _compile_assign(self, root, name, result): - str_name = "%s" % name - if str_name in ("None", "True", "False"): + if name in [HySymbol(x) for x in ("None", "True", "False")]: raise self._syntax_error(name, - "Can't assign to `%s'" % str_name) + "Can't assign to `{}'".format(name)) result = self.compile(result) ld_name = self.compile(name) if isinstance(ld_name.expr, ast.Call): raise self._syntax_error(name, - "Can't assign to a callable: `%s'" % str_name) + "Can't assign to a callable: `{}'".format(name)) if (result.temp_variables and isinstance(name, HySymbol)