r/programmingtools • u/TomAnthony • Aug 06 '15
Terminal iTermocil - Create pre-defined window/pane layout (inc. commands) in iTerm
https://github.com/TomAnthony/itermocil
15
Upvotes
r/programmingtools • u/TomAnthony • Aug 06 '15
View all comments
Show parent comment
2
u/ericpruitt Aug 07 '15
Sure, I've taken a look through the code again, and here are some other suggestions:
if major_version < 2.9:I don't have a Mac, so I don't know what the most recent version of iTerm is, but if there's a version 2.10, 2.89, etc., your comparison will fail. Don't convert the version number into a float. Instead, do a comparison liketuple(int(n) for n in version_string.split(".")) > (2, 9)to get proper version comparisons.itermocil. If I were just browsing the code and sawitermocil(...), I'm going to assume it's a function because by convention, Python classes are Camel-cased making it easy to pick out which things are standard function calls and which things are class instantiations without having to read all of the code.sys.exitinstead ofexit. See this StackOverflow post for more info.if num_panes == 2: \n if layout == 'tiled':; that could be a singleifconditional withand. See also line 321.rangewith 0 as the first argument. By default, allrangeare indexed from 0 by default making that redundant.nthdictionary would work best as a class-level or module-level constant so the interpreter doesn't have to recreate the dictionary every time that function is called. It's possible Python optimizes this out, but I'm too lazy to examine the bytecode to find out.