Skip to content

Commit 0e23ed0

Browse files
Merge pull request #68 from rpanderson/is-syntax-warning
Do not use 'is' for numeric literal comparisons
2 parents 5b52c20 + 6373f02 commit 0e23ed0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

labscript/labscript.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def bitfield(arrays,dtype):
102102
"""converts a list of arrays of ones and zeros into a single
103103
array of unsigned ints of the given datatype."""
104104
n = {uint8:8,uint16:16,uint32:32}
105-
if arrays[0] is 0:
105+
if arrays[0] == 0:
106106
y = zeros(max([len(arr) if iterable(arr) else 1 for arr in arrays]),dtype=dtype)
107107
else:
108108
y = array(arrays[0],dtype=dtype)
@@ -1120,7 +1120,7 @@ def __init__(self,name,parent_device,connection,limits = None,unit_conversion_cl
11201120
# Here we specifically differentiate "None" from False as we will later have a conditional which relies on
11211121
# self.limits being either a correct tuple, or "None"
11221122
if limits is not None:
1123-
if not isinstance(limits,tuple) or len(limits) is not 2:
1123+
if not isinstance(limits,tuple) or len(limits) != 2:
11241124
raise LabscriptError('The limits for "%s" must be tuple of length 2. Eg. limits=(1,2)'%(self.name))
11251125
if limits[0] > limits[1]:
11261126
raise LabscriptError('The first element of the tuple must be lower than the second element. Eg limits=(1,2), NOT limits=(2,1)')

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy