News for hackers. Stuff that matters.
Re:Python Anti-Pattern by bjoli on Thursday September 16, 2021 @02:28PM (#28555306)
Oh my, that's awful. Even in python there are better ways to close over a value :)

I haven't written python in many years, but in the following example it is at least clear what is going on:

   def make_printer(n):
       def printer():
           print(n)
       return printer
   [make_printer(i) for i in range(2)]

There are no comments on this comment yet.