From 2700ab8a7fa487582a88f20c961e5adc6d59ba0a Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 14 Feb 2023 10:19:03 -0800 Subject: [PATCH] Aliases for builtins in Python Joy. --- implementations/Python/joy.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/implementations/Python/joy.py b/implementations/Python/joy.py index 3798c21..df09ded 100755 --- a/implementations/Python/joy.py +++ b/implementations/Python/joy.py @@ -1028,6 +1028,26 @@ for F in ( inscribe(F) +for alias, name in ( + ('+', 'add'), + ('-', 'sub'), + ('/', 'floordiv'), + ('%', 'mod'), + ('*', 'mul'), + ('>', 'gt'), + ('<', 'lt'), + ('>=', 'ge'), + ('<=', 'le'), + ('!=', 'ne'), + ('<>', 'ne'), + ('=', 'eq'), + ): + try: + _dictionary[alias] = _dictionary[name] + except KeyError: + pass + + ''' ██████╗ ███████╗███████╗██╗███╗ ██╗██╗████████╗██╗ ██████╗ ███╗ ██╗███████╗ ██╔══██╗██╔════╝██╔════╝██║████╗ ██║██║╚══██╔══╝██║██╔═══██╗████╗ ██║██╔════╝