I use the following "assert" to check the value of an argument in a function. I have a function "test" that accepts a logical input "arg1", which can be None, True or False. Is it ok to make sure "arg1" is only one of these possible values?
def test(arg1=None):
assert arg1 in set([None, True, False]), "Not a valid input"
...
My friend tells me the following:
I canβt do it. You must compare True, False, and None as identifiers (is not =). Doing in is equivalent to multiple = 's. You must support separate files.
It is right?
Diego source
share