Skip to content

Commit b2489af

Browse files
committed
Add special case for _ symbol
1 parent d6d6728 commit b2489af

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

monic/expressions/interpreter.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,11 @@ def _set_name_value(self, name: str, value: t.Any) -> None:
304304
Set the value of a name, considering 'global' and 'nonlocal'
305305
declarations.
306306
"""
307+
# Special case for '_'
308+
if name == "_":
309+
self.global_env["_"] = value
310+
return
311+
307312
# If declared global in the current scope:
308313
if name in self.current_scope.globals:
309314
self.global_env[name] = value

0 commit comments

Comments
 (0)