Type checker and None arguments


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):


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?


Please sign in to leave a comment.