News for hackers. Stuff that matters.
Re:Google Python Style Guide by gorgoiler on Saturday February 11, 2023 @08:49AM (#34752275)
You are right — the return thing is very silly. What about this:

  def greet(…, bow=False):
    …
    if bow:
      take_a_bow()
Except imagine take_a_bow() instead as 10 lines of code to perform the post-greeting bow-ceremony. That code takes additional arguments regarding what kind of hand flourish to perform while bowing. The flourish_type has to be an optional argument to greet (because bow is) but inside the bow you have to assert flourish_type is not None because you can’t bow without knowing what flourish to give.

I’ve seen some dark stuff over the years.

Also: Welcome to HN!

Re:Google Python Style Guide by m3047 on Saturday February 11, 2023 @01:00PM (#34754603)

  def greet(bow=None):
    ...
    if bow:
      bow()

  def elsewhere(gesture):
    def bow():
      print(gesture)
    greet(bow)
Wrap that.