2 ms·
So, a more complete example might help: def myFunc(par=None): if par: # do whatever is needed when the parameter exists pass #finish proces
by LostJourneyman 6y ago
So, a more complete example might help:
def myFunc(par=None):
if par:
# do whatever is needed when the parameter exists
pass
#finish processing
This allows you to pass in [], {}, None, '', or omit par all together, which will all behave as if par=None, or pass in data and use it appropriately. You can also use
if not par:
pass
if you want to do the inverse.