News for hackers. Stuff that matters.
Re:Toolz: A functional standard library for Python by tutfbhuf on Thursday January 21, 2021 @02:53PM (#25863333)
But you can define functions inside of functions (recursively).

  def function1():
      print ("hello outer")
      def function2():
          print ("hello inner")
      function2()

  function1()
Output:

  hello outer
  hello inner
Re:Toolz: A functional standard library for Python by throwaway894345 on Thursday January 21, 2021 @03:15PM (#25863626)
But you can’t do that (or try/except) in an expression such as a list comprehension or similar.
Re:Toolz: A functional standard library for Python by robertlagrant on Thursday January 21, 2021 @05:06PM (#25865079)
Yes, because gross.
Re:Toolz: A functional standard library for Python by dragonwriter on Thursday January 21, 2021 @06:08PM (#25865880)
Nor, IMO, should you want to.
Re:Toolz: A functional standard library for Python by throwaway894345 on Friday January 22, 2021 @08:44AM (#25871569)
Why not? Many other languages have closures and even Python has lambdas. Multi-line closures work well for these languages including in map/reduce/etc or comprehensions where applicable. Seems like your preference is overfit to Python’s limitations.
Re:Toolz: A functional standard library for Python by robertlagrant on Friday February 05, 2021 @03:15AM (#26034176)
Because you can do it in a function. It's not a limitation when you can do it. Having to define a function that's easier to read, and testable as an independent unit, is not a problem.