Repository: wright-group/WrightTools

Issue:
PEP 8 E741
Do we care about pep8 error E741, which prohibits the use of `l` and `I` and `O` as variable names


We only ever use `l` (the lower case L), but the idea is that these glyphs are easily confused with capital `I` and numerals `1` or `0` (dependent on the font)

Official PEP0008 text: https://www.python.org/dev/peps/pep-0008/#names-to-avoid

If we wish to be totally pep8 compliant, we should capitalize the variable name wherever used


Discussion:
I think this is reasonable to be PEP8 compliant
I really like naming throwaway lists `l`, but I know this is a bad habit. In my font they are distinguishable from `1`, so I never get confused.

I know we are already not pep8 compliant, but in this case I think we should bend the knee.

I'll make a pull request with all of the `l`s renamed at some point.
alternatives include `L` `ell` or `lis` for throwaway lists

I will also note there is one place (in `dOD`) that uses `I` 

They are also distinguishable in my font, I just saw the warnings

Resolving patch:
diff --git a/WrightTools/artists.py b/WrightTools/artists.py
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -1314,14 +1314,13 @@ def plot_gridlines(ax=None, c='grey', lw=1, diagonal=False, zorder=2,
     # grid
     # ax.grid(True)
     lines = ax.xaxis.get_gridlines() + ax.yaxis.get_gridlines()
-    for l in lines.copy():
-        l = l
-        l.set_linestyle(':')
-        l.set_color(c)
-        l.set_linewidth(lw)
-        l.set_zorder(zorder)
-        l.set_dashes(dashes)
-        ax.add_line(l)
+    for line in lines.copy():
+        line.set_linestyle(':')
+        line.set_color(c)
+        line.set_linewidth(lw)
+        line.set_zorder(zorder)
+        line.set_dashes(dashes)
+        ax.add_line(line)
     # diagonal
     if diagonal:
         min_xi, max_xi = ax.get_xlim()
diff --git a/WrightTools/data.py b/WrightTools/data.py
--- a/WrightTools/data.py
+++ b/WrightTools/data.py
@@ -916,10 +916,10 @@ def dOD(self, signal_channel, reference_channel,
         else:
             print('channel type', type(reference_channel), 'not valid')
         # process
-        I = self.channels[reference_channel_index].values.copy()
-        dI = self.channels[signal_channel_index].values.copy()
+        intensity = self.channels[reference_channel_index].values.copy()
+        d_intensity = self.channels[signal_channel_index].values.copy()
         if method == 'digital':
-            out = -np.log10((I + dI) / I)
+            out = -np.log10((intensity + d_intensity) / intensity)
         elif method == 'boxcar':
             # assume data collected with boxcar i.e.
             # sig = 1/2 dT
diff --git a/WrightTools/kit.py b/WrightTools/kit.py
--- a/WrightTools/kit.py
+++ b/WrightTools/kit.py
@@ -1045,8 +1045,8 @@ def __init__(self, xi, yi, k=3, s=1000, ignore_nans=True):
         yi_internal = np.array(yi).copy()
         # nans
         if ignore_nans:
-            l = [xi_internal, yi_internal]
-            xi_internal, yi_internal = remove_nans_1D(l)
+            lis = [xi_internal, yi_internal]
+            xi_internal, yi_internal = remove_nans_1D(lis)
         # UnivariateSpline needs ascending xi
         sort = np.argsort(xi_internal)
         xi_internal = xi_internal[sort]
@@ -1157,8 +1157,8 @@ def flatten_list(l):
             else:
                 Temp.append(element)
         listIsNested = keepChecking  # determine if outer loop exits
-        l = Temp[:]
-    return l
+        lis = Temp[:]
+    return lis
 
 
 def get_methods(the_class, class_only=False, instance_only=False,
@@ -1322,9 +1322,9 @@ def string2array(string, sep='\t'):
         shape[i] = shape[i] / shape[i - 1]
     shape = tuple([int(s) for s in shape])
     # import list of floats
-    l = string.split(' ')
+    lis = string.split(' ')
     # annoyingly series of negative values get past previous filters
-    l = flatten_list([i.split('-') for i in l])
+    lis = flatten_list([i.split('-') for i in lis])
     for i, item in enumerate(l):
         bad_chars = ['[', ']', '\t', '\n']
         for bad_char in bad_chars:


Test patch: