306 right: Output
307
308 @property
309 def device(self) -> Union[str, None]:310 """Determine the Device Associated with this Stereo Output."""
311 if self.left.device == self.right.device:
312 return self.right.device
239 right: Input
240
241 @property
242 def device(self) -> Union[str, None]:243 """Determine the Device Associated with this Stereo Input."""
244 if self.left.device == self.right.device:
245 return self.right.device
According to PEP8, if any return statement returns an expression, any return statements where no value is returned should explicitly state this as return None
, and an explicit return statement should be present at the end of the function (if reachable).
Good:
def foo(x):
if x >= 0:
return math.sqrt(x)
else:
return None
def bar(x):
if x < 0:
return None
return math.sqrt(x)
Bad:
def foo(x):
if x >= 0:
return math.sqrt(x)
def bar(x):
if x < 0:
return
return math.sqrt(x)