News for hackers. Stuff that matters.
Re:Python’s tug of war between beginner-friendly and advance... by andi999 on Saturday February 06, 2021 @09:04AM (#26046534)
How do you define the function in that case?
Re:Python’s tug of war between beginner-friendly and advance... by LostJourneyman on Sunday February 07, 2021 @10:46AM (#26055750)
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.