Wednesday, November 14, 2012

Python one-line if statement

After days of fiddling, I finally broke the code for the one-line if syntax in Python. This is so that my gseos menu options can call a python routine, and have the result from that routine be the condition for calling other functions. I had previously already figured out that these menu options were essentially just python statements and that I could have multiple statements by linking them together with semicolons. This extends it even further, probably further than the gseos architects even intended.

My menu items now look like this:

if routine(): statement1;statement2;statement3

The key breakthrough was that after the semicolon had to be one space (a tab did not work) and to give up using curly braces around the three statements.