Type checker and None arguments
Hello,
I like to use the type checker for spotting errors in my code but I am annoyed by repeated warnings of the kind:
Expected type 'object', got 'None' instead.
If receive them for example in this case:
def demo(s: object):
pass
demo(None)
But I sometimes want a function that can take an object or None as the argument. How can I explain to the type checker that None is legitimate argument?
--Peter
I like to use the type checker for spotting errors in my code but I am annoyed by repeated warnings of the kind:
Expected type 'object', got 'None' instead.
If receive them for example in this case:
def demo(s: object):
pass
demo(None)
But I sometimes want a function that can take an object or None as the argument. How can I explain to the type checker that None is legitimate argument?
--Peter
Please sign in to leave a comment.