From 1be364d065a6e3a884ffae3eee5800075fbd49dc Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 16 Feb 2016 23:25:58 +0200 Subject: [PATCH] Issue #188: Adopted the solution suggested by JP to not use the operator module when performing the sorting on exobj,tools and use instead the lambda function. --- camlib.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/camlib.py b/camlib.py index 1296f4f3..d4c82400 100644 --- a/camlib.py +++ b/camlib.py @@ -55,8 +55,6 @@ from svgparse import * import logging -import operator - log = logging.getLogger('base2') log.setLevel(logging.DEBUG) # log.setLevel(logging.WARNING) @@ -2713,7 +2711,7 @@ class CNCjob(Geometry): # sort the tools list by the second item in tuple (here we have a dict with diameter of the tool) # so we actually are sorting the tools by diameter - sorted_tools = sorted(exobj.tools.items(), key = operator.itemgetter(1)) + sorted_tools = sorted(exobj.tools.items(), key = (lambda x: x[1])) if tools == "all": tools = str([i[0] for i in sorted_tools]) # we get a string of ordered tools log.debug("Tools 'all' and sorted are: %s" % str(tools))