Is it correct to pass None to a parameter?

There’s nothing wrong with using None to mean “I am not supplying this argument”.

You can check for None in your code:

if c is None:
    # do something
if d is not None:
    # do something else

One recommendation I would make is to have None be the default argument for any optional arguments:

def myfunct(a, b, e, f, c=None, d=None):
    # do something

myfunct(A, B, E, F)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)