In response to a message written on 07.01.2015, 19:29, from Adam Wolf:
I dunno, LordBlick, it looks pretty Pythonic to me!
Also, I do not think
dict(map(lambda lname: lname, layers_tuple.index(lname), layers_tuple))
is clearer than using a dictionary called layer_dict :)
Auto-generated functions below are always up to date, layers names and number in
KiCAD still evaluates, so we can not rely on ordinary static, an independent
dictionary.
lsLayers = tuple([(idl, pcbnew.BOARD_GetStandardLayerName(idl)) for idl in
range(pcbnew.LAYER_ID_COUNT)])
layerName2ID = lambda txtLayer: dict(map(reversed, lsLayers)).get(txtLayer)
layerID2Name = lambda layerID: dict(lsLayers).get(layerID)
3 lines concluding bilateral conversion vs. 24 lines of dictionary only…
Thank you for your attention! :)
--
Best Regards,
LordBlick
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help : https://help.launchpad.net/ListHelp