METRIC / SAE Indicator for pyVCP

More
9 years 11 months ago - 9 years 11 months ago #83431 by andypugh

cmorley wrote:

Code:
for i in sorted(status.gcodes[1:]): if i == -1: continue if i % 10 == 0: if i == 210: metric = True break elif i == 200: metric = False break


Isn't this more Pythonic:
Code:
metric = True if 210 in s.gcodes else False
Last edit: 9 years 11 months ago by andypugh.

Please Log in or Create an account to join the conversation.

More
9 years 11 months ago #83466 by cmorley
yes it is.
My example came from code in gscreen which parses gcode for different reasons.
I was not trying for the best code, just an example.

Chris M

Please Log in or Create an account to join the conversation.

Time to create page: 0.259 seconds
Powered by Kunena Forum