is
when comparing type
of two objects212 """
213 logging.info("Beginning bash autocompletion generation")
214
215 if not type(commands) == list:216 raise ValueError("Expected list of commands, got string instead")
217
218 sub_commands = [root] # list of just top level sub-commands
is
when comparing type
of two objects163
164
165 logging.info(f"Beginning list ({arguments}) stringification")
166 if not (type(arguments) == list or type(arguments) == tuple):167 raise ValueError("Expected list of arguments, got string instead")
168
169 stringified = ""
is
when comparing type
of two objects163
164
165 logging.info(f"Beginning list ({arguments}) stringification")
166 if not (type(arguments) == list or type(arguments) == tuple):167 raise ValueError("Expected list of arguments, got string instead")
168
169 stringified = ""
It is recommended to use identity test
( is
) instead of equality test ( ==
) when you need to compare types of two objects.
if type(x) == str:
print(x)
if type(x) is str:
print(x)
# Alternatively,
if isinstance(x, str):
print(x)