News for hackers. Stuff that matters.
Re:Strict Python function parameters by klyrs on Sunday January 23, 2022 @03:35PM (#30050178)
Having mylist stick around is actually useful for making stateful functions. For example, I've often used

  def foo(..., cache={}):
    ...
to implement cached functions, or functions which need an internal cache for whatever reason. Later versions of Python provide an lru cache decorator, but that doesn't help with the internal cache and can be inefficient when you don't want your cache to forget any results.

There are no comments on this comment yet.