I want to replace the next expression with something simpler but i'm not sure what my changes impli?
if not (self.permission_index_link == 0) \ or not (self.permission_index_link == 8):
with
if not self.permission_index_link == (0,8):
I want to replace the next expression with something simpler but i'm not sure what my changes impli?
if not (self.permission_index_link == 0) \ or not (self.permission_index_link == 8):
with
if not self.permission_index_link == (0,8):
if self.permission_index_link not in (0,8):
# code
Is this what you are looking for? code will run if self.permission_index_link
is not 0 or 8.
Are you sure your initial expression is correct? It will always be true. Didn't you mean to use and
rather than or
?
Use the not in
operator:
if self.permission_index_link not in (0,8):