Rexx Vs Python

by H. Fosdick   © 2024

For those who know one of these languages and want to learn about the other. Click here for PDF version.

The Basics

Easy to learn, use, and maintain  Yes  Yes
Very powerful  Yes  Yes
Open source  Yes  Yes
Portable  Yes  Yes
Runs on all platforms  Yes  Yes
Interfaces to tons of tools  Yes  Yes
ANSI or ISO Standard  Yes  (ANSI-1996)  No  (de facto standard by PEPs)


DialectsTRL-2, ANSI, Mainframe, ooRexx, NetRexxVersion 2.x, Version 3.x, specialized implementations
Unique Usage * Default scripting language for mainframes and several minor platforms
* Interfaces to all mainframe environments and address spaces
* Most popular programming language in the world
* Most widely taught language
* Ships with many OS's
Programming paradigmsProcedural, object-oriented (ooRexx and NetRexx), functional, scriptingProcedural, object-oriented, functional, scripting
OOP: classes, objects, multi-inheritance, polymorphism, encapsulationYes, in ooRexx and NetRexxYes
User GroupRexx Language Association Python community
Quick Online LookupQuick Lookup QuickRef
Cheat Sheet
(printable PDF)
ANSI Rexx, Mainframe Rexx Python 3, Cheatography
ForumRexxLA forum Python forums

Language Comparison

 ANSI RexxPython
FormattingFree formBased on indentation rules
CommentsEnclose inside /* and */Start line with # or enclose inside triple quotes (""")
Line Continuation, (comma)\ (backslash) or implicit
Statement Separator; (semi-colon); (semi-colon)
Code BlocksDefine by do - endDefine by : (colon) plus indentation
Undefined VariablesAllowed. Use SYMBOL to determine if a variable has been definedUndefined variable raises NameError. Circumvent this by assigning special constant None.
Assignment Operators= =  +=  -=  *=  /=  %=  //=  **=  :=
Compound Bitwise:  &=  |=  ^=  >>=  <<=
Arithmetic Operators+  -  *  /  %  **  // +  -  *  /  %  **  //
Compound: +=  -=  *=  /=  %=  //=  **=
Comparison Operators==  \==  >>  <<  >>=  \<<  <<=  \>>  =  \=  <>  ><  >  <  >=  \<  <=  \>
( \ can be replaced with ¬ in any of these)
==  !=  >  <  >=  <=  
Object Identity: is  is not
Logical Operators&  |  &&  \ (prefix)  ¬ (prefix) and  or  not
Concatenation Operators||  Or concatenate with blank between
Or, concatenate by abuttal (no blank)
+   +=   * (multiple copies of a string)    Concatenate literal strings with blank beween. Use f-strings. Use join or format methods
Bitwise OperatorsUse built-in functions &  |  ^  ~  <<  >>
Compound: &=  |=  ^=  <<=  >>=
Membership OperatorsUnsupported in  not in
Regular ExpressionsUse RexxRE Regular Expressions external Library Use the re module
Built-in FunctionsAbout 70 functions About 70 functions
Data TypesEverything's a string, types are reflected in usageA dynamically typed language with these data types: text (str), numeric (int, float, complex), sequence (list, tuple, range), mapping (dict), set (set, frozenset), boolean (bool), binary (bytes, bytearray, memoryview)
Function to Check Data Typedatatypetype
Collections of VariablesUse compound variableslist, tuple, range, set, frozenset, dict, bytearray
Associative ArraysUse compound variablesUse a dictionary (dict)
Multidimensional ArraysUse compound variablesUse NumPy library
Stack & Queue OperationsYes (push, pull, parse pull, queue, queued)Yes (queue module and deque from collections)
Decimal ArithmeticDefaultUse the decimal module
Flow of Controlif, do, select, call, exit, return, iterate, leave, signal, nop if, for, while, break, continue, pass, return, exit, quit, match-case
Trace Script Executiontrace (instruction), trace (function) Use the trace or pdb modules
Terminate Processexitexit()
Get User Inputsay "Enter your name:"
parse pull name
name = input("Enter your name: ")
Exception Handlingsignaltry-except-else-finally, raise, with
Standard Exceptionsnovalue, error, failure, halt, notready, syntax, lostdigits SyntaxError, TypeError, NameError, IndexError, KeyError, ValueError, AttributeError, IOError, ZeroDivisionError, ImportError
Run an Operating System CommandJust issue the command string
(Rexx passes unrecognized strings to the default active environment)
Use the subprocess module (or older os module)

Based on Rexx Programmer's Reference, Python Tutorial, and Python Language Reference (v 3.12.3).

Back to    .     .