The converter supports core Python syntax (which is very powerful), but does not implement the built in Python libraries that you would get in desktop Python. You have to rely on the ability to call HP42S commands from Python to do your work - which of course you can do. Specifically, it has the following capabilities:

Variables

Functions, Multiple functions, nested functions

Parameter passing, receiving return values, multiple return values

if elif else

Comparison operators == != > < >= <=

Booleans True, False and operators not or and

for loops, range(), for..in iteration through lists and dictionary keys

while loops, while...else

continue and break operations in for loops and while loops

Lists and Dictionaries (basic operations only).

Matrices, Pythonic matrix element access syntax [row,col]

NumPy compatible slicing syntax for sub-matrices

Complex numbers using either 42S or Python native syntax

Expressions involving nested brackets

assert

Testing and clearing of flags

Access most HP42S commands as function calls e.g. FIX(2)

Some enhanced functions to make life easier e.g. varmenu() automates and simplifies the generation of MVAR based code.

Included in the examples are some graphic primitive routines originally written for the Raspberry Pi in C rewritten into Python and converted to RPN. This now gives the 42S a small graphics library to generate lines, circles, rectangles, filled shapes etc. More information in this related thread. This would be of particular interest to owners of the DM42 calculator which has the larger screen, crying out to be taken advantage of.

and targeting the larger screen size of the DM42 - this image:

The purpose of the Python to RPN converter is not to usurp the beauty and role of handcrafted RPN, it is to provide an alternative way of programming the HP42S for those who prefer to to use if statements and for loops etc. rather than GTO's and ISG. The purpose is also to provide powerful new features to make programming the 42S easier: lists, dictionaries, matrix access syntax, native complex number syntax, alpha messages easily built with multiple parameters in one line, simpler menu support using aview() etc.

My hope is that the Python to RPN converter will contribute to keeping this wonderfully designed calculator alive, just as Free42 and the DM42 have done. I look forward to what people build, using the increased ease of use and power of a structured programming language and hope to see some great new programs developed for the DM42.

I hope people like it.

Last edited by tcab on Fri Feb 16, 2018 8:48 pm, edited 1 time in total.

That means in the very near future some java programmer like me could write Java code, and convert it to RPN too. Very, very exciting possibilities indeed. Providing memory permits, it probably is possible to write Java code for most of the functions an HP48 or an HP50g provides and port it to DM42. I will surely try this converter.

New release today - Converter page now has a Clear button and a New Project link - as well as no initial demo code - nice and clean. A new LBL main start point for programs is the new default, allowing access to the Python global scope area - great for sharing variables between functions. Programs written with this paradigm are likely to be more appealing to RPN programmers and look like:

Variable references now look outwards from functions into their outer functions (if any)... all the way to global scope - until they find the variable. This is how nested scope works in most programming languages, including Python. Read all about scope in the help file.

Other features released today are the ability to edit and delete cloned example snippets, as well as vote on them. A new simplified menu() command has been added - there are a couple of examples showing how you can rapidly build custom menus and submenus.